diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-10-22 06:19:57 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-10-22 06:19:57 -0400 |
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 b9611344ff9e..5c35bbaf881e 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, | |||
1745 | info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1745 | info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
1746 | info->count = channels; | 1746 | info->count = channels; |
1747 | info->value.enumerated.items = items; | 1747 | info->value.enumerated.items = items; |
1748 | if (!items) | ||
1749 | return 0; | ||
1748 | if (info->value.enumerated.item >= items) | 1750 | if (info->value.enumerated.item >= items) |
1749 | info->value.enumerated.item = items - 1; | 1751 | info->value.enumerated.item = items - 1; |
1752 | WARN(strlen(names[info->value.enumerated.item]) >= sizeof(info->value.enumerated.name), | ||
1753 | "ALSA: too long item name '%s'\n", | ||
1754 | names[info->value.enumerated.item]); | ||
1750 | strlcpy(info->value.enumerated.name, | 1755 | strlcpy(info->value.enumerated.name, |
1751 | names[info->value.enumerated.item], | 1756 | names[info->value.enumerated.item], |
1752 | sizeof(info->value.enumerated.name)); | 1757 | sizeof(info->value.enumerated.name)); |