Commit 7f0df88c authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Return error for invalid setup for VIA

Instead of ignoring the invalid pin configuration, return the error.
This will avoid unexpected crash, anyway.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent d7a99cce
...@@ -2341,7 +2341,7 @@ static int vt1708_parse_auto_config(struct hda_codec *codec) ...@@ -2341,7 +2341,7 @@ static int vt1708_parse_auto_config(struct hda_codec *codec)
if (err < 0) if (err < 0)
return err; return err;
if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0]) if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0])
return 0; /* can't find valid BIOS pin config */ return -EINVAL;
err = via_auto_create_multi_out_ctls(codec); err = via_auto_create_multi_out_ctls(codec);
if (err < 0) if (err < 0)
...@@ -2460,12 +2460,8 @@ static int patch_vt1708(struct hda_codec *codec) ...@@ -2460,12 +2460,8 @@ static int patch_vt1708(struct hda_codec *codec)
if (err < 0) { if (err < 0) {
via_free(codec); via_free(codec);
return err; return err;
} else if (!err) {
printk(KERN_INFO "hda_codec: Cannot set up configuration "
"from BIOS. Using genenic mode...\n");
} }
/* disable 32bit format on VT1708 */ /* disable 32bit format on VT1708 */
if (codec->vendor_id == 0x11061708) if (codec->vendor_id == 0x11061708)
spec->stream_analog_playback = &vt1708_pcm_analog_s16_playback; spec->stream_analog_playback = &vt1708_pcm_analog_s16_playback;
...@@ -2541,7 +2537,7 @@ static int vt1709_parse_auto_config(struct hda_codec *codec) ...@@ -2541,7 +2537,7 @@ static int vt1709_parse_auto_config(struct hda_codec *codec)
if (err < 0) if (err < 0)
return err; return err;
if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0]) if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0])
return 0; /* can't find valid BIOS pin config */ return -EINVAL;
err = via_auto_create_multi_out_ctls(codec); err = via_auto_create_multi_out_ctls(codec);
if (err < 0) if (err < 0)
...@@ -2602,9 +2598,6 @@ static int patch_vt1709_10ch(struct hda_codec *codec) ...@@ -2602,9 +2598,6 @@ static int patch_vt1709_10ch(struct hda_codec *codec)
if (err < 0) { if (err < 0) {
via_free(codec); via_free(codec);
return err; return err;
} else if (!err) {
printk(KERN_INFO "hda_codec: Cannot set up configuration. "
"Using genenic mode...\n");
} }
spec->init_verbs[spec->num_iverbs++] = vt1709_10ch_volume_init_verbs; spec->init_verbs[spec->num_iverbs++] = vt1709_10ch_volume_init_verbs;
...@@ -2679,9 +2672,6 @@ static int patch_vt1709_6ch(struct hda_codec *codec) ...@@ -2679,9 +2672,6 @@ static int patch_vt1709_6ch(struct hda_codec *codec)
if (err < 0) { if (err < 0) {
via_free(codec); via_free(codec);
return err; return err;
} else if (!err) {
printk(KERN_INFO "hda_codec: Cannot set up configuration. "
"Using genenic mode...\n");
} }
spec->init_verbs[spec->num_iverbs++] = vt1709_6ch_volume_init_verbs; spec->init_verbs[spec->num_iverbs++] = vt1709_6ch_volume_init_verbs;
...@@ -2795,7 +2785,7 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec) ...@@ -2795,7 +2785,7 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec)
if (err < 0) if (err < 0)
return err; return err;
if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0]) if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0])
return 0; /* can't find valid BIOS pin config */ return -EINVAL;
err = via_auto_create_multi_out_ctls(codec); err = via_auto_create_multi_out_ctls(codec);
if (err < 0) if (err < 0)
...@@ -2940,9 +2930,6 @@ static int patch_vt1708B_8ch(struct hda_codec *codec) ...@@ -2940,9 +2930,6 @@ static int patch_vt1708B_8ch(struct hda_codec *codec)
if (err < 0) { if (err < 0) {
via_free(codec); via_free(codec);
return err; return err;
} else if (!err) {
printk(KERN_INFO "hda_codec: Cannot set up configuration "
"from BIOS. Using genenic mode...\n");
} }
spec->init_verbs[spec->num_iverbs++] = vt1708B_8ch_volume_init_verbs; spec->init_verbs[spec->num_iverbs++] = vt1708B_8ch_volume_init_verbs;
...@@ -2976,9 +2963,6 @@ static int patch_vt1708B_4ch(struct hda_codec *codec) ...@@ -2976,9 +2963,6 @@ static int patch_vt1708B_4ch(struct hda_codec *codec)
if (err < 0) { if (err < 0) {
via_free(codec); via_free(codec);
return err; return err;
} else if (!err) {
printk(KERN_INFO "hda_codec: Cannot set up configuration "
"from BIOS. Using genenic mode...\n");
} }
spec->init_verbs[spec->num_iverbs++] = vt1708B_4ch_volume_init_verbs; spec->init_verbs[spec->num_iverbs++] = vt1708B_4ch_volume_init_verbs;
...@@ -3087,7 +3071,7 @@ static int vt1708S_parse_auto_config(struct hda_codec *codec) ...@@ -3087,7 +3071,7 @@ static int vt1708S_parse_auto_config(struct hda_codec *codec)
if (err < 0) if (err < 0)
return err; return err;
if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0]) if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0])
return 0; /* can't find valid BIOS pin config */ return -EINVAL;
err = via_auto_create_multi_out_ctls(codec); err = via_auto_create_multi_out_ctls(codec);
if (err < 0) if (err < 0)
...@@ -3157,9 +3141,6 @@ static int patch_vt1708S(struct hda_codec *codec) ...@@ -3157,9 +3141,6 @@ static int patch_vt1708S(struct hda_codec *codec)
if (err < 0) { if (err < 0) {
via_free(codec); via_free(codec);
return err; return err;
} else if (!err) {
printk(KERN_INFO "hda_codec: Cannot set up configuration "
"from BIOS. Using genenic mode...\n");
} }
spec->init_verbs[spec->num_iverbs++] = vt1708S_volume_init_verbs; spec->init_verbs[spec->num_iverbs++] = vt1708S_volume_init_verbs;
...@@ -3253,7 +3234,7 @@ static int vt1702_parse_auto_config(struct hda_codec *codec) ...@@ -3253,7 +3234,7 @@ static int vt1702_parse_auto_config(struct hda_codec *codec)
if (err < 0) if (err < 0)
return err; return err;
if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0]) if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0])
return 0; /* can't find valid BIOS pin config */ return -EINVAL;
err = via_auto_create_multi_out_ctls(codec); err = via_auto_create_multi_out_ctls(codec);
if (err < 0) if (err < 0)
...@@ -3344,9 +3325,6 @@ static int patch_vt1702(struct hda_codec *codec) ...@@ -3344,9 +3325,6 @@ static int patch_vt1702(struct hda_codec *codec)
if (err < 0) { if (err < 0) {
via_free(codec); via_free(codec);
return err; return err;
} else if (!err) {
printk(KERN_INFO "hda_codec: Cannot set up configuration "
"from BIOS. Using genenic mode...\n");
} }
spec->init_verbs[spec->num_iverbs++] = vt1702_volume_init_verbs; spec->init_verbs[spec->num_iverbs++] = vt1702_volume_init_verbs;
...@@ -3440,7 +3418,7 @@ static int vt1718S_parse_auto_config(struct hda_codec *codec) ...@@ -3440,7 +3418,7 @@ static int vt1718S_parse_auto_config(struct hda_codec *codec)
if (err < 0) if (err < 0)
return err; return err;
if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0]) if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0])
return 0; /* can't find valid BIOS pin config */ return -EINVAL;
err = via_auto_create_multi_out_ctls(codec); err = via_auto_create_multi_out_ctls(codec);
if (err < 0) if (err < 0)
...@@ -3569,9 +3547,6 @@ static int patch_vt1718S(struct hda_codec *codec) ...@@ -3569,9 +3547,6 @@ static int patch_vt1718S(struct hda_codec *codec)
if (err < 0) { if (err < 0) {
via_free(codec); via_free(codec);
return err; return err;
} else if (!err) {
printk(KERN_INFO "hda_codec: Cannot set up configuration "
"from BIOS. Using genenic mode...\n");
} }
spec->init_verbs[spec->num_iverbs++] = vt1718S_volume_init_verbs; spec->init_verbs[spec->num_iverbs++] = vt1718S_volume_init_verbs;
...@@ -3726,7 +3701,7 @@ static int vt1716S_parse_auto_config(struct hda_codec *codec) ...@@ -3726,7 +3701,7 @@ static int vt1716S_parse_auto_config(struct hda_codec *codec)
if (err < 0) if (err < 0)
return err; return err;
if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0]) if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0])
return 0; /* can't find valid BIOS pin config */ return -EINVAL;
err = via_auto_create_multi_out_ctls(codec); err = via_auto_create_multi_out_ctls(codec);
if (err < 0) if (err < 0)
...@@ -3879,9 +3854,6 @@ static int patch_vt1716S(struct hda_codec *codec) ...@@ -3879,9 +3854,6 @@ static int patch_vt1716S(struct hda_codec *codec)
if (err < 0) { if (err < 0) {
via_free(codec); via_free(codec);
return err; return err;
} else if (!err) {
printk(KERN_INFO "hda_codec: Cannot set up configuration "
"from BIOS. Using genenic mode...\n");
} }
spec->init_verbs[spec->num_iverbs++] = vt1716S_volume_init_verbs; spec->init_verbs[spec->num_iverbs++] = vt1716S_volume_init_verbs;
...@@ -4051,7 +4023,7 @@ static int vt2002P_parse_auto_config(struct hda_codec *codec) ...@@ -4051,7 +4023,7 @@ static int vt2002P_parse_auto_config(struct hda_codec *codec)
return err; return err;
if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0]) if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0])
return 0; /* can't find valid BIOS pin config */ return -EINVAL;
err = via_auto_create_multi_out_ctls(codec); err = via_auto_create_multi_out_ctls(codec);
if (err < 0) if (err < 0)
...@@ -4218,9 +4190,6 @@ static int patch_vt2002P(struct hda_codec *codec) ...@@ -4218,9 +4190,6 @@ static int patch_vt2002P(struct hda_codec *codec)
if (err < 0) { if (err < 0) {
via_free(codec); via_free(codec);
return err; return err;
} else if (!err) {
printk(KERN_INFO "hda_codec: Cannot set up configuration "
"from BIOS. Using genenic mode...\n");
} }
if (spec->codec_type == VT1802) if (spec->codec_type == VT1802)
...@@ -4332,7 +4301,7 @@ static int vt1812_parse_auto_config(struct hda_codec *codec) ...@@ -4332,7 +4301,7 @@ static int vt1812_parse_auto_config(struct hda_codec *codec)
return err; return err;
if (!spec->autocfg.line_outs && !spec->autocfg.hp_outs) if (!spec->autocfg.line_outs && !spec->autocfg.hp_outs)
return 0; /* can't find valid BIOS pin config */ return -EINVAL;
err = via_auto_create_multi_out_ctls(codec); err = via_auto_create_multi_out_ctls(codec);
if (err < 0) if (err < 0)
...@@ -4480,12 +4449,8 @@ static int patch_vt1812(struct hda_codec *codec) ...@@ -4480,12 +4449,8 @@ static int patch_vt1812(struct hda_codec *codec)
if (err < 0) { if (err < 0) {
via_free(codec); via_free(codec);
return err; return err;
} else if (!err) {
printk(KERN_INFO "hda_codec: Cannot set up configuration "
"from BIOS. Using genenic mode...\n");
} }
spec->init_verbs[spec->num_iverbs++] = vt1812_volume_init_verbs; spec->init_verbs[spec->num_iverbs++] = vt1812_volume_init_verbs;
spec->init_verbs[spec->num_iverbs++] = vt1812_uniwill_init_verbs; spec->init_verbs[spec->num_iverbs++] = vt1812_uniwill_init_verbs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment