aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/control.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-10-20 12:08:50 -0400
committerTakashi Iwai <tiwai@suse.de>2014-10-20 12:25:41 -0400
commita7e6fb99150ebb2852ebd0e7bad9ce37cc9a79dd (patch)
tree17248fa8afa98fef3ec38ca332ec921cd95ff062 /sound/core/control.c
parentdf803e1389716bcdf11932fff47d7f1fc198bc8a (diff)
ALSA: control: Allow to pass items zero to snd_ctl_enum_info()
Although this is weird, some drivers want to allow empty control elements intentionally, e.g. the number of items may change depending on the firmware status. Let the function simply returning in such a case. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/control.c')
-rw-r--r--sound/core/control.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index f95df84437e1..5c35bbaf881e 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -1745,6 +1745,8 @@ 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;
1750 WARN(strlen(names[info->value.enumerated.item]) >= sizeof(info->value.enumerated.name), 1752 WARN(strlen(names[info->value.enumerated.item]) >= sizeof(info->value.enumerated.name),