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

Configure Feed

Select the types of activity you want to include in your feed.

ALSA: hda: Avoid WARN_ON() for HDMI chmap slot checks

At parsing the channel mapping for HDMI, the current code may spew
WARN_ON() unnecessarily for the case where only invalid (zero) channel
maps are given from the hardware. Drop WARN_ON() and reorganize the
code a bit for avoiding the hdmi_slot over the array size.

Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221390
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260428061800.80527-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+7 -4
+7 -4
sound/hda/core/hdmi_chmap.c
··· 353 353 if (hdmi_channel_mapping[ca][1] == 0) { 354 354 int hdmi_slot = 0; 355 355 /* fill actual channel mappings in ALSA channel (i) order */ 356 - for (i = 0; i < ch_alloc->channels; i++) { 357 - while (!WARN_ON(hdmi_slot >= 8) && 358 - !ch_alloc->speakers[7 - hdmi_slot]) 359 - hdmi_slot++; /* skip zero slots */ 356 + for (i = 0; i < ch_alloc->channels && hdmi_slot < 8; i++) { 357 + while (!ch_alloc->speakers[7 - hdmi_slot]) { 358 + /* skip zero slots */ 359 + if (++hdmi_slot >= 8) 360 + goto out; 361 + } 360 362 361 363 hdmi_channel_mapping[ca][i] = (i << 4) | hdmi_slot++; 362 364 } 365 + out: 363 366 /* fill the rest of the slots with ALSA channel 0xf */ 364 367 for (hdmi_slot = 0; hdmi_slot < 8; hdmi_slot++) 365 368 if (!ch_alloc->speakers[7 - hdmi_slot])