Browse Source

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>
Takashi Iwai 13 years ago
parent
commit
5803a32646
1 changed files with 3 additions and 0 deletions
  1. 3 0
      sound/pci/hda/patch_realtek.c

+ 3 - 0
sound/pci/hda/patch_realtek.c

@@ -302,6 +302,9 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx,
 	int i, type, num_conns;
 	int i, type, num_conns;
 	hda_nid_t nid;
 	hda_nid_t nid;
 
 
+	if (!spec->input_mux)
+		return 0;
+
 	mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
 	mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
 	imux = &spec->input_mux[mux_idx];
 	imux = &spec->input_mux[mux_idx];
 	if (!imux->num_items && mux_idx > 0)
 	if (!imux->num_items && mux_idx > 0)