From 8bdaf62cd29683c1e83c473a026e54b59b5c420c Mon Sep 17 00:00:00 2001 From: Naveen Manohar Date: Mon, 31 Aug 2026 10:33:29 +0530 Subject: [PATCH] ASoC: SOF: ipc4-compress: Add NULL checks for pcm_ops Patch adds NULL checks before dereferencing pcm_ops to prevent potential NULL pointer deref issues & fix -Werror=analyzer-null-dereference build failures. Signed-off-by: Naveen Manohar --- sound/soc/sof/ipc4-compress.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/sof/ipc4-compress.c b/sound/soc/sof/ipc4-compress.c index 05cebb780032e7..839287796742bd 100644 --- a/sound/soc/sof/ipc4-compress.c +++ b/sound/soc/sof/ipc4-compress.c @@ -107,6 +107,9 @@ static int sof_ipc4_compr_stream_free(struct snd_sof_dev *sdev, int ret = 0; int err = 0; + if (!pcm_ops) + return -EINVAL; + if (spcm->prepared[dir]) { if (spcm->pending_stop[dir]) pcm_ops->trigger(sdev->component, NULL, spcm, @@ -542,6 +545,9 @@ static int sof_ipc4_compr_trigger(struct snd_soc_component *component, bool trigger_platform = false; int ret = 0; + if (!pcm_ops || !pcm_ops->trigger) + return -EINVAL; + spcm = snd_sof_find_spcm_dai(component, rtd); if (!spcm) { dev_err(sdev->dev, "%s: can't find spcm\n", __func__);