From: Dan Carpenter <dan.carpenter@linaro.org>
To: Daniel Baluta <daniel.baluta@nxp.com>
Cc: broonie@kernel.org, linux-sound@vger.kernel.org,
imx@lists.linux.dev, linux-kernel@vger.kernel.org,
Frank.Li@nxp.com, robh@kernel.org, laurentiu.mihalcea@nxp.com,
waqar.hameed@axis.com, festevam@gmail.com, kernel@pengutronix.de,
lgirdwood@gmail.com, peter.ujfalusi@linux.intel.com,
yung-chuan.liao@linux.intel.com,
ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com
Subject: Re: [PATCH] ASoC: SOF: imx: Fix devm_ioremap_resource check
Date: Tue, 2 Sep 2025 09:33:25 +0300 [thread overview]
Message-ID: <aLaPtf-eZ6sM47yV@stanley.mountain> (raw)
In-Reply-To: <20250901151513.286454-1-daniel.baluta@nxp.com>
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@nxp.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
prev parent reply other threads:[~2025-09-02 6:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-01 15:15 [PATCH] ASoC: SOF: imx: Fix devm_ioremap_resource check Daniel Baluta
2025-09-01 15:35 ` Mark Brown
2025-09-02 6:33 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aLaPtf-eZ6sM47yV@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=Frank.Li@nxp.com \
--cc=broonie@kernel.org \
--cc=daniel.baluta@nxp.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kai.vehmanen@linux.intel.com \
--cc=kernel@pengutronix.de \
--cc=laurentiu.mihalcea@nxp.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=peter.ujfalusi@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=robh@kernel.org \
--cc=waqar.hameed@axis.com \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).