Skip to content

Commit

Permalink
ALSA: HDA VIA: Fix crash on codecs without Headphone
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
  • Loading branch information
Harald Welte authored and Jaroslav Kysela committed Sep 23, 2008
1 parent a6d7731 commit f8fdd49
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions sound/pci/hda/patch_via.c
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,8 @@ static int vt1708_parse_auto_config(struct hda_codec *codec)

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;
}
Expand Down Expand Up @@ -1773,6 +1774,9 @@ static int vt1709_parse_auto_config(struct hda_codec *codec)

spec->input_mux = &spec->private_imux[0];

if (spec->hp_mux)
spec->mixers[spec->num_mixers++] = via_hp_mixer;

return 1;
}

Expand Down Expand Up @@ -2314,7 +2318,8 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec)

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;
}
Expand Down Expand Up @@ -2770,7 +2775,8 @@ static int vt1708S_parse_auto_config(struct hda_codec *codec)

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;
}
Expand Down Expand Up @@ -3100,7 +3106,8 @@ static int vt1702_parse_auto_config(struct hda_codec *codec)

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;
}
Expand Down

0 comments on commit f8fdd49

Please sign in to comment.