diff options
-rw-r--r-- | sound/pci/hda/hda_codec.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 18ef0aa69d98..239cdd855dfe 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -2341,6 +2341,8 @@ int snd_hda_input_mux_info(const struct hda_input_mux *imux, | |||
2341 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2341 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
2342 | uinfo->count = 1; | 2342 | uinfo->count = 1; |
2343 | uinfo->value.enumerated.items = imux->num_items; | 2343 | uinfo->value.enumerated.items = imux->num_items; |
2344 | if (!imux->num_items) | ||
2345 | return 0; | ||
2344 | index = uinfo->value.enumerated.item; | 2346 | index = uinfo->value.enumerated.item; |
2345 | if (index >= imux->num_items) | 2347 | if (index >= imux->num_items) |
2346 | index = imux->num_items - 1; | 2348 | index = imux->num_items - 1; |
@@ -2356,6 +2358,8 @@ int snd_hda_input_mux_put(struct hda_codec *codec, | |||
2356 | { | 2358 | { |
2357 | unsigned int idx; | 2359 | unsigned int idx; |
2358 | 2360 | ||
2361 | if (!imux->num_items) | ||
2362 | return 0; | ||
2359 | idx = ucontrol->value.enumerated.item[0]; | 2363 | idx = ucontrol->value.enumerated.item[0]; |
2360 | if (idx >= imux->num_items) | 2364 | if (idx >= imux->num_items) |
2361 | idx = imux->num_items - 1; | 2365 | idx = imux->num_items - 1; |