diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-02-21 05:59:45 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-02-21 05:59:45 -0500 |
commit | 5803a326465e38ee3cab8badbd8947732a8277f5 (patch) | |
tree | 21abe80de9685862a4cca2ac5f0fa0a4998401cd /sound/pci/hda/patch_realtek.c | |
parent | 164f73ee93131f67a61eaca6a6f6180580c39445 (diff) |
ALSA: hda/realtek - Fix possible Oops with NULL input_mux
When BIOS is damn crazy and gives no pin-config at all, the driver might
lead to a NULL dereference. Let's add a NULL check for such a case.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index eba50dff6130..997cc8127a08 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -302,6 +302,9 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, | |||
302 | int i, type, num_conns; | 302 | int i, type, num_conns; |
303 | hda_nid_t nid; | 303 | hda_nid_t nid; |
304 | 304 | ||
305 | if (!spec->input_mux) | ||
306 | return 0; | ||
307 | |||
305 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; | 308 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
306 | imux = &spec->input_mux[mux_idx]; | 309 | imux = &spec->input_mux[mux_idx]; |
307 | if (!imux->num_items && mux_idx > 0) | 310 | if (!imux->num_items && mux_idx > 0) |