From 5803a326465e38ee3cab8badbd8947732a8277f5 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 21 Feb 2012 11:59:45 +0100
Subject: [PATCH] ALSA: hda/realtek - Fix possible Oops with NULL input_mux
Git-commit: 5803a326465e38ee3cab8badbd8947732a8277f5
Patch-mainline: 3.4-rc3
References: FATE#314311

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>

---
 sound/pci/hda/patch_realtek.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -301,6 +301,9 @@ static int alc_mux_select(struct hda_cod
 	int i, type, num_conns;
 	hda_nid_t nid;
 
+	if (!spec->input_mux)
+		return 0;
+
 	mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
 	imux = &spec->input_mux[mux_idx];
 	if (!imux->num_items && mux_idx > 0)
