Skip to content

Commit 084ca21

Browse files
crojewsk-inteltiwai
authored andcommitted
ALSA: hda: Error out if invalid stream is being setup
Scenario when snd_hdac_stream_setup_periods() receives an instance of struct hdac_stream with neither ->substream nor ->cstream initialized is invalid. Simultaneously addresses "uninitialized symbol 'dmab'" error reported by Smatch. Fixes: 3e95822 ("ALSA: hda: Interrupt servicing and BDL setup for compress streams") Signed-off-by: Cezary Rojewski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent a587601 commit 084ca21

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sound/hda/hdac_stream.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,9 @@ int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev)
500500
dmab = snd_pcm_get_dma_buf(substream);
501501
} else if (cstream) {
502502
dmab = snd_pcm_get_dma_buf(cstream);
503+
} else {
504+
WARN(1, "No substream or cstream assigned\n");
505+
return -EINVAL;
503506
}
504507

505508
/* reset BDL address */

0 commit comments

Comments
 (0)