diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-10-22 12:19:57 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-10-22 12:19:57 +0200 |
commit | 930352862e9533fecc42c7ed20798a7c9e3aa874 (patch) | |
tree | f234d6eb69c077f898e375aef30c9550dcf069d7 /sound/core | |
parent | b46882b6eb713245916100ac5b58664cd242a08d (diff) | |
parent | 7bbd03e0143b562ff7d96f7e71c016104020b550 (diff) |
Merge branch 'topic/enum-info-cleanup' into for-next
this is a series of patches to just convert the plain info callback
for enum ctl elements to snd_ctl_elem_info(). Also, it includes the
extension of snd_ctl_elem_info(), for catching the unexpected string
cut-off and handling the zero items.
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/control.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/core/control.c b/sound/core/control.c index b9611344ff9..5c35bbaf881 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -1745,8 +1745,13 @@ int snd_ctl_enum_info(struct snd_ctl_elem_info *info, unsigned int channels, info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; info->count = channels; info->value.enumerated.items = items; + if (!items) + return 0; if (info->value.enumerated.item >= items) info->value.enumerated.item = items - 1; + WARN(strlen(names[info->value.enumerated.item]) >= sizeof(info->value.enumerated.name), + "ALSA: too long item name '%s'\n", + names[info->value.enumerated.item]); strlcpy(info->value.enumerated.name, names[info->value.enumerated.item], sizeof(info->value.enumerated.name)); |