diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2008-10-29 15:40:30 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-10-29 15:44:04 +0100 |
commit | 366840d7e1ece4331bb3ccc2a53e3bc355529f21 (patch) | |
tree | 5353796bb299452c5978b08328863f796b9eeae0 /sound/core/control.c | |
parent | ALSA: intel8x0 - add Dell Optiplex GX620 (AD1981B) to AC97 clock whitelist (diff) | |
download | linux-366840d7e1ece4331bb3ccc2a53e3bc355529f21.tar.xz linux-366840d7e1ece4331bb3ccc2a53e3bc355529f21.zip |
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>
Diffstat (limited to 'sound/core/control.c')
-rw-r--r-- | sound/core/control.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sound/core/control.c b/sound/core/control.c index 6d71f9a7ccbb..b0bf42691047 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -225,8 +225,13 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol, kctl.id.iface = ncontrol->iface; kctl.id.device = ncontrol->device; kctl.id.subdevice = ncontrol->subdevice; - if (ncontrol->name) + if (ncontrol->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.count = ncontrol->count ? ncontrol->count : 1; access = ncontrol->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE : |