From: Yang Yingliang Date: Wed, 27 Oct 2021 06:52:28 +0000 (+0800) Subject: ASoC: amd: acp: Fix return value check in acp_machine_select() X-Git-Tag: v5.16-rc3~45^2~4^2~51 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=fdde18b9773636cc5866ccd8f2093e1cf0022dea;p=users%2Fhch%2Fmisc.git ASoC: amd: acp: Fix return value check in acp_machine_select() In case of error, platform_device_register_data() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Reported-by: Hulk Robot Fixes: e646b51f5dd5 ("ASoC: amd: acp: Add callback for machine driver on ACP") Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20211027065228.833825-1-yangyingliang@huawei.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/amd/acp/acp-platform.c b/sound/soc/amd/acp/acp-platform.c index 75003d0a41e3..65a809e2c29f 100644 --- a/sound/soc/amd/acp/acp-platform.c +++ b/sound/soc/amd/acp/acp-platform.c @@ -81,7 +81,7 @@ int acp_machine_select(struct acp_dev_data *adata) adata->mach_dev = platform_device_register_data(adata->dev, mach->drv_name, PLATFORM_DEVID_NONE, mach, size); - if (!adata->mach_dev) + if (IS_ERR(adata->mach_dev)) dev_warn(adata->dev, "Unable to register Machine device\n"); return 0;