diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-10-09 11:58:41 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 16:51:07 +0200 |
commit | 5513b0c58222d21b704cf352c554d9ab86c3fd97 (patch) | |
tree | b2f51e7c1cf57e7a311657ce96537f999f336bad /sound | |
parent | 2469049e728ee0542d6617f81311a18a14e73826 (diff) | |
download | linux-3.10-5513b0c58222d21b704cf352c554d9ab86c3fd97.tar.gz linux-3.10-5513b0c58222d21b704cf352c554d9ab86c3fd97.tar.bz2 linux-3.10-5513b0c58222d21b704cf352c554d9ab86c3fd97.zip |
[ALSA] hda-codec - Add zero checks in input-mux helper functions
Added zero checks in input-mux helper functions to avoid Oops.
Some devices may have no input pins while the driver registers
control elements calling these functions.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound')
-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 18ef0aa69d9..239cdd855df 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, uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; uinfo->value.enumerated.items = imux->num_items; + if (!imux->num_items) + return 0; index = uinfo->value.enumerated.item; if (index >= imux->num_items) index = imux->num_items - 1; @@ -2356,6 +2358,8 @@ int snd_hda_input_mux_put(struct hda_codec *codec, { unsigned int idx; + if (!imux->num_items) + return 0; idx = ucontrol->value.enumerated.item[0]; if (idx >= imux->num_items) idx = imux->num_items - 1; |