Commit 366840d7 authored by Mark Brown's avatar Mark Brown Committed by Takashi Iwai

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: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 78fad343
...@@ -225,8 +225,13 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol, ...@@ -225,8 +225,13 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol,
kctl.id.iface = ncontrol->iface; kctl.id.iface = ncontrol->iface;
kctl.id.device = ncontrol->device; kctl.id.device = ncontrol->device;
kctl.id.subdevice = ncontrol->subdevice; kctl.id.subdevice = ncontrol->subdevice;
if (ncontrol->name) if (ncontrol->name) {
strlcpy(kctl.id.name, ncontrol->name, sizeof(kctl.id.name)); strlcpy(kctl.id.name, ncontrol->name, sizeof(kctl.id.name));
if (strcmp(ncontrol->name, kctl.id.name) != 0)
snd_printk(KERN_WARNING
"Control name '%s' truncated to '%s'\n",
ncontrol->name, kctl.id.name);
}
kctl.id.index = ncontrol->index; kctl.id.index = ncontrol->index;
kctl.count = ncontrol->count ? ncontrol->count : 1; kctl.count = ncontrol->count ? ncontrol->count : 1;
access = ncontrol->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE : access = ncontrol->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE :
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment