mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 07:51:31 -04:00
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: aca961f196 ("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>
This commit is contained in:
committed by
Mark Brown
parent
9968aad12f
commit
6cbc8360f5
@@ -480,16 +480,20 @@ int hda_dsp_iccmax_stream_hw_params(struct snd_sof_dev *sdev, struct hdac_ext_st
|
||||
struct snd_dma_buffer *dmab,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct hdac_stream *hstream = &hext_stream->hstream;
|
||||
int sd_offset = SOF_STREAM_SD_OFFSET(hstream);
|
||||
struct hdac_stream *hstream;
|
||||
int sd_offset;
|
||||
int ret;
|
||||
u32 mask = 0x1 << hstream->index;
|
||||
u32 mask;
|
||||
|
||||
if (!hext_stream) {
|
||||
dev_err(sdev->dev, "error: no stream available\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
hstream = &hext_stream->hstream;
|
||||
sd_offset = SOF_STREAM_SD_OFFSET(hstream);
|
||||
mask = 0x1 << hstream->index;
|
||||
|
||||
if (!dmab) {
|
||||
dev_err(sdev->dev, "error: no dma buffer allocated!\n");
|
||||
return -ENODEV;
|
||||
|
||||
Reference in New Issue
Block a user