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

ASoC: SOF: imx: remove error checks on NULL ipc

imx_dsp_get_data() can return NULL, but the value is not checked
before being usd, leading to static analysis warnings.

sound/soc/sof/imx/imx8.c:85:32: error: dereference of NULL ‘0’
[CWE-476] [-Werror=analyzer-null-dereference]

85 | spin_lock_irqsave(&priv->sdev->ipc_lock, flags);
| ~~~~^~~~~~

It appears this is not really a possible problem, so remove those checks.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Link: https://lore.kernel.org/r/20230731213748.440285-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Pierre-Louis Bossart and committed by
Mark Brown
e302f8d9 55cb3dc2

-6
-6
include/linux/firmware/imx/dsp.h
··· 37 37 38 38 static inline void imx_dsp_set_data(struct imx_dsp_ipc *ipc, void *data) 39 39 { 40 - if (!ipc) 41 - return; 42 - 43 40 ipc->private_data = data; 44 41 } 45 42 46 43 static inline void *imx_dsp_get_data(struct imx_dsp_ipc *ipc) 47 44 { 48 - if (!ipc) 49 - return NULL; 50 - 51 45 return ipc->private_data; 52 46 } 53 47