[ALSA] HDA VIA: Fix crash on codecs without Headphone
Don't enumerate via_hp_mixer while hp_mux is null (headphone does not exist), to fix the crash of via_independent_hp_info (via_hp_mixer's .info), which will reference hp_mux.
Signed-off-by: Logan Li LoganLi@viatech.com.cn Signed-off-by: Harald Welte HaraldWelte@viatech.com
--- a/sound/pci/hda/patch_via.c 2008-09-10 00:55:25.000000000 +0800 +++ b/sound/pci/hda/patch_via.c 2008-09-15 14:07:29.000000000 +0800 @@ -1303,7 +1303,8 @@
spec->input_mux = &spec->private_imux[0];
- spec->mixers[spec->num_mixers++] = via_hp_mixer; + if (spec->hp_mux) + spec->mixers[spec->num_mixers++] = via_hp_mixer;
return 1; } @@ -1773,6 +1774,9 @@
spec->input_mux = &spec->private_imux[0];
+ if (spec->hp_mux) + spec->mixers[spec->num_mixers++] = via_hp_mixer; + return 1; }
@@ -2314,7 +2318,8 @@
spec->input_mux = &spec->private_imux[0];
- spec->mixers[spec->num_mixers++] = via_hp_mixer; + if (spec->hp_mux) + spec->mixers[spec->num_mixers++] = via_hp_mixer;
return 1; } @@ -2770,7 +2775,8 @@
spec->input_mux = &spec->private_imux[0];
- spec->mixers[spec->num_mixers++] = via_hp_mixer; + if (spec->hp_mux) + spec->mixers[spec->num_mixers++] = via_hp_mixer;
return 1; } @@ -3100,7 +3106,8 @@
spec->input_mux = &spec->private_imux[0];
- spec->mixers[spec->num_mixers++] = via_hp_mixer; + if (spec->hp_mux) + spec->mixers[spec->num_mixers++] = via_hp_mixer;
return 1; }