Skip to content

Commit 6cbc836

Browse files
Ethan Tidmorebroonie
authored andcommitted
ASoC: SOF: Intel: hda: Place check before dereference
The struct hext_stream is dereferenced before it is checked for NULL. Although it can never be NULL due to a check prior to hda_dsp_iccmax_stream_hw_params() being called, this change clears any confusion regarding hext_stream possibly being NULL. Check hext_stream for NULL and then assign its members. Detected by Smatch: sound/soc/sof/intel/hda-stream.c:488 hda_dsp_iccmax_stream_hw_params() warn: variable dereferenced before check 'hext_stream' (see line 486) Fixes: aca961f ("ASoC: SOF: Intel: hda: Add helper function to program ICCMAX stream") Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com> Link: https://patch.msgid.link/20260324173830.17563-1-ethantidmore06@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 9968aad commit 6cbc836

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

sound/soc/sof/intel/hda-stream.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,16 +480,20 @@ int hda_dsp_iccmax_stream_hw_params(struct snd_sof_dev *sdev, struct hdac_ext_st
480480
struct snd_dma_buffer *dmab,
481481
struct snd_pcm_hw_params *params)
482482
{
483-
struct hdac_stream *hstream = &hext_stream->hstream;
484-
int sd_offset = SOF_STREAM_SD_OFFSET(hstream);
483+
struct hdac_stream *hstream;
484+
int sd_offset;
485485
int ret;
486-
u32 mask = 0x1 << hstream->index;
486+
u32 mask;
487487

488488
if (!hext_stream) {
489489
dev_err(sdev->dev, "error: no stream available\n");
490490
return -ENODEV;
491491
}
492492

493+
hstream = &hext_stream->hstream;
494+
sd_offset = SOF_STREAM_SD_OFFSET(hstream);
495+
mask = 0x1 << hstream->index;
496+
493497
if (!dmab) {
494498
dev_err(sdev->dev, "error: no dma buffer allocated!\n");
495499
return -ENODEV;

0 commit comments

Comments
 (0)