From: Takashi Iwai Date: Fri, 2 Dec 2011 14:29:12 +0000 (+0100) Subject: ALSA: hda/realtek - Fix Oops in alc_mux_select() X-Git-Tag: MMI-PSA29.97-13-9~17823^2~11 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cce4aa378a049f4275416ee6302dd24f37b289df;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git ALSA: hda/realtek - Fix Oops in alc_mux_select() When no imux is available (e.g. a single capture source), alc_auto_init_input_src() may trigger an Oops due to the access to -1. Add a proper zero-check to avoid it. Cc: Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index cbde019d3d52..a7d1bc4e0d09 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -297,6 +297,8 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, imux = &spec->input_mux[mux_idx]; if (!imux->num_items && mux_idx > 0) imux = &spec->input_mux[0]; + if (!imux->num_items) + return 0; if (idx >= imux->num_items) idx = imux->num_items - 1;