Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[ALSA] hda-codec - Avoid zero NID in line_out_pins[] of STAC codecs

The STAC codes adds line_out_pins[] for shared mic/line-inputs accordingly.
But, the current code may give a hole with NID=0 in some setting, which
results in an error at probe. This patch fixes the problem.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>

authored by

Takashi Iwai and committed by
Jaroslav Kysela
c480f79b dc81bed1

+10 -5
+10 -5
sound/pci/hda/patch_sigmatel.c
··· 1479 1479 case 3: 1480 1480 /* add line-in as side */ 1481 1481 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) { 1482 - cfg->line_out_pins[3] = cfg->input_pins[AUTO_PIN_LINE]; 1482 + cfg->line_out_pins[cfg->line_outs] = 1483 + cfg->input_pins[AUTO_PIN_LINE]; 1483 1484 spec->line_switch = 1; 1484 1485 cfg->line_outs++; 1485 1486 } ··· 1488 1487 case 2: 1489 1488 /* add line-in as clfe and mic as side */ 1490 1489 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) { 1491 - cfg->line_out_pins[2] = cfg->input_pins[AUTO_PIN_LINE]; 1490 + cfg->line_out_pins[cfg->line_outs] = 1491 + cfg->input_pins[AUTO_PIN_LINE]; 1492 1492 spec->line_switch = 1; 1493 1493 cfg->line_outs++; 1494 1494 } 1495 1495 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) { 1496 - cfg->line_out_pins[3] = cfg->input_pins[AUTO_PIN_MIC]; 1496 + cfg->line_out_pins[cfg->line_outs] = 1497 + cfg->input_pins[AUTO_PIN_MIC]; 1497 1498 spec->mic_switch = 1; 1498 1499 cfg->line_outs++; 1499 1500 } ··· 1503 1500 case 1: 1504 1501 /* add line-in as surr and mic as clfe */ 1505 1502 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) { 1506 - cfg->line_out_pins[1] = cfg->input_pins[AUTO_PIN_LINE]; 1503 + cfg->line_out_pins[cfg->line_outs] = 1504 + cfg->input_pins[AUTO_PIN_LINE]; 1507 1505 spec->line_switch = 1; 1508 1506 cfg->line_outs++; 1509 1507 } 1510 1508 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) { 1511 - cfg->line_out_pins[2] = cfg->input_pins[AUTO_PIN_MIC]; 1509 + cfg->line_out_pins[cfg->line_outs] = 1510 + cfg->input_pins[AUTO_PIN_MIC]; 1512 1511 spec->mic_switch = 1; 1513 1512 cfg->line_outs++; 1514 1513 }