Skip to content

Commit 75dc198

Browse files
committed
ALSA: ctxfi: Don't enumerate SPDIF1 at DAIO initialization
The recent refactoring of xfi driver changed the assignment of atc->daios[] at atc_get_resources(); now it loops over all enum DAIOTYP entries while it looped formerly only a part of them. The problem is that the last entry, SPDIF1, is a special type that is used only for hw20k1 CTSB073X model (as a replacement of SPDIFIO), and there is no corresponding definition for hw20k2. Due to the lack of the info, it caused a kernel crash on hw20k2, which was already worked around by the commit b045ab3 ("ALSA: ctxfi: Fix missing SPDIFI1 index handling"). This patch addresses the root cause of the regression above properly, simply by skipping the incorrect SPDIF1 type in the parser loop. For making the change clearer, the code is slightly arranged, too. Fixes: a2dbaeb ("ALSA: ctxfi: Refactor resource alloc for sparse mappings") Cc: <stable@vger.kernel.org> Link: https://bugzilla.suse.com/show_bug.cgi?id=1259925 Link: https://patch.msgid.link/20260331081227.216134-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent e6c8882 commit 75dc198

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

sound/pci/ctxfi/ctatc.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,10 +1427,14 @@ static int atc_get_resources(struct ct_atc *atc)
14271427
daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO];
14281428
da_desc.msr = atc->msr;
14291429
for (i = 0; i < NUM_DAIOTYP; i++) {
1430-
if (((i == MIC) && !cap.dedicated_mic) || ((i == RCA) && !cap.dedicated_rca))
1430+
if (((i == MIC) && !cap.dedicated_mic) ||
1431+
((i == RCA) && !cap.dedicated_rca) ||
1432+
i == SPDIFI1)
14311433
continue;
1432-
da_desc.type = (atc->model != CTSB073X) ? i :
1433-
((i == SPDIFIO) ? SPDIFI1 : i);
1434+
if (atc->model == CTSB073X && i == SPDIFIO)
1435+
da_desc.type = SPDIFI1;
1436+
else
1437+
da_desc.type = i;
14341438
da_desc.output = (i < LINEIM) || (i == RCA);
14351439
err = daio_mgr->get_daio(daio_mgr, &da_desc,
14361440
(struct daio **)&atc->daios[i]);

0 commit comments

Comments
 (0)