ALSA: Warn when control names are truncated

This is likely to confuse user interfaces since the end of the control
name is interpreted (eg, "Volume", "Switch").

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Mark Brown and committed by
Takashi Iwai
366840d7 78fad343

+6 -1
+6 -1
sound/core/control.c
··· 225 225 kctl.id.iface = ncontrol->iface; 226 226 kctl.id.device = ncontrol->device; 227 227 kctl.id.subdevice = ncontrol->subdevice; 228 - if (ncontrol->name) 228 + if (ncontrol->name) { 229 229 strlcpy(kctl.id.name, ncontrol->name, sizeof(kctl.id.name)); 230 + if (strcmp(ncontrol->name, kctl.id.name) != 0) 231 + snd_printk(KERN_WARNING 232 + "Control name '%s' truncated to '%s'\n", 233 + ncontrol->name, kctl.id.name); 234 + } 230 235 kctl.id.index = ncontrol->index; 231 236 kctl.count = ncontrol->count ? ncontrol->count : 1; 232 237 access = ncontrol->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE :