[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aLaPtf-eZ6sM47yV@stanley.mountain>
Date: Tue, 2 Sep 2025 09:33:25 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Daniel Baluta <daniel.baluta@....com>
Cc: broonie@...nel.org, linux-sound@...r.kernel.org, imx@...ts.linux.dev,
linux-kernel@...r.kernel.org, Frank.Li@....com, robh@...nel.org,
laurentiu.mihalcea@....com, waqar.hameed@...s.com,
festevam@...il.com, kernel@...gutronix.de, lgirdwood@...il.com,
peter.ujfalusi@...ux.intel.com, yung-chuan.liao@...ux.intel.com,
ranjani.sridharan@...ux.intel.com, kai.vehmanen@...ux.intel.com
Subject: Re: [PATCH] ASoC: SOF: imx: Fix devm_ioremap_resource check
On Mon, Sep 01, 2025 at 06:15:13PM +0300, Daniel Baluta wrote:
> devm_ioremap_resource does not return NULL on error
> but an error pointer so we need to use IS_ERR to check
> the return code.
>
> Fixes: bc163baef570 ("ASoC: Use of_reserved_mem_region_to_resource() for "memory-region"")
> Signed-off-by: Daniel Baluta <daniel.baluta@....com>
> ---
> sound/soc/sof/imx/imx-common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/sof/imx/imx-common.c b/sound/soc/sof/imx/imx-common.c
> index 40debc541bf9..b3248c65215d 100644
> --- a/sound/soc/sof/imx/imx-common.c
> +++ b/sound/soc/sof/imx/imx-common.c
> @@ -316,7 +316,7 @@ static int imx_parse_ioremap_memory(struct snd_sof_dev *sdev)
> }
>
> sdev->bar[blk_type] = devm_ioremap_resource(sdev->dev, res);
> - if (!sdev->bar[blk_type])
> + if (IS_ERR(sdev->bar[blk_type]))
> return dev_err_probe(sdev->dev,
> -ENOMEM,
It's annoying that I didn't catch this bug. It's because the error
pointer was stored in an array instead of a a "simple" variable.
Smatch does actually have a lower quality warning for this but I
wasn't reviewing them since that check had too many false positives.
I've done a little hack around, so this bug will be caught in the
future and it found a few other similar bugs which I've fixed as well.
regards,
dan carpenter
Powered by blists - more mailing lists