diff mbox series

[-next] ASoC: SOF: imx8: Fix return value check in imx8_probe()

Message ID 20190826120003.183279-1-weiyongjun1@huawei.com (mailing list archive)
State Mainlined
Commit 393151c211006cc5ac6af26ecd9982dd916a8104
Headers show
Series [-next] ASoC: SOF: imx8: Fix return value check in imx8_probe() | expand

Commit Message

Wei Yongjun Aug. 26, 2019, noon UTC
In case of error, the function devm_ioremap_wc() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: 202acc565a1f ("ASoC: SOF: imx: Add i.MX8 HW support")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 sound/soc/sof/imx/imx8.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Daniel Baluta Aug. 26, 2019, 12:01 p.m. UTC | #1
On Mon, 2019-08-26 at 12:00 +0000, Wei Yongjun wrote:
> In case of error, the function devm_ioremap_wc() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should be
> replaced with NULL test.
> 
> Fixes: 202acc565a1f ("ASoC: SOF: imx: Add i.MX8 HW support")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Good catch. Thanks!

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>

> ---
>  sound/soc/sof/imx/imx8.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
> index e502f584207f..263d4df35fe8 100644
> --- a/sound/soc/sof/imx/imx8.c
> +++ b/sound/soc/sof/imx/imx8.c
> @@ -296,10 +296,10 @@ static int imx8_probe(struct snd_sof_dev *sdev)
>  	sdev->bar[SOF_FW_BLK_TYPE_SRAM] = devm_ioremap_wc(sdev->dev,
> res.start,
>  							  res.end -
> res.start +
>  							  1);
> -	if (IS_ERR(sdev->bar[SOF_FW_BLK_TYPE_SRAM])) {
> +	if (!sdev->bar[SOF_FW_BLK_TYPE_SRAM]) {
>  		dev_err(sdev->dev, "failed to ioremap mem 0x%x size
> 0x%x\n",
>  			base, size);
> -		ret = PTR_ERR(sdev->bar[SOF_FW_BLK_TYPE_SRAM]);
> +		ret = -ENOMEM;
>  		goto exit_pdev_unregister;
>  	}
>  	sdev->mailbox_bar = SOF_FW_BLK_TYPE_SRAM;
> 
> 
>
diff mbox series

Patch

diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
index e502f584207f..263d4df35fe8 100644
--- a/sound/soc/sof/imx/imx8.c
+++ b/sound/soc/sof/imx/imx8.c
@@ -296,10 +296,10 @@  static int imx8_probe(struct snd_sof_dev *sdev)
 	sdev->bar[SOF_FW_BLK_TYPE_SRAM] = devm_ioremap_wc(sdev->dev, res.start,
 							  res.end - res.start +
 							  1);
-	if (IS_ERR(sdev->bar[SOF_FW_BLK_TYPE_SRAM])) {
+	if (!sdev->bar[SOF_FW_BLK_TYPE_SRAM]) {
 		dev_err(sdev->dev, "failed to ioremap mem 0x%x size 0x%x\n",
 			base, size);
-		ret = PTR_ERR(sdev->bar[SOF_FW_BLK_TYPE_SRAM]);
+		ret = -ENOMEM;
 		goto exit_pdev_unregister;
 	}
 	sdev->mailbox_bar = SOF_FW_BLK_TYPE_SRAM;