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

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

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

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

90 | 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-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Pierre-Louis Bossart and committed by
Mark Brown
8cf52862 e302f8d9

-6
-6
include/linux/firmware/mediatek/mtk-adsp-ipc.h
··· 46 46 47 47 static inline void mtk_adsp_ipc_set_data(struct mtk_adsp_ipc *ipc, void *data) 48 48 { 49 - if (!ipc) 50 - return; 51 - 52 49 ipc->private_data = data; 53 50 } 54 51 55 52 static inline void *mtk_adsp_ipc_get_data(struct mtk_adsp_ipc *ipc) 56 53 { 57 - if (!ipc) 58 - return NULL; 59 - 60 54 return ipc->private_data; 61 55 } 62 56