From: Philipp Zabel <p.zabel@pengutronix.de>
To: Chen Ni <nichen@iscas.ac.cn>,
Frank.Li@nxp.com, s.hauer@pengutronix.de, kernel@pengutronix.de,
festevam@gmail.com
Cc: imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] reset: imx7: Check return value of regmap_attach_dev() in imx7_reset_probe()
Date: Thu, 05 Feb 2026 09:02:06 +0100 [thread overview]
Message-ID: <68979ef7dbd839e4e601bd579f2d3b199a0d350e.camel@pengutronix.de> (raw)
In-Reply-To: <20260205034219.2531280-1-nichen@iscas.ac.cn>
On Do, 2026-02-05 at 11:42 +0800, Chen Ni wrote:
> Add error checking for regmap_attach_dev() call in imx7_reset_probe()
> function to ensure proper error propagation.
>
> Return the value of regmap_attach_dev() if it fails to prevent
> proceeding with an incomplete regmap setup.
>
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
> drivers/reset/reset-imx7.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/reset/reset-imx7.c b/drivers/reset/reset-imx7.c
> index dd01fe11c5cb..59d0435302bb 100644
> --- a/drivers/reset/reset-imx7.c
> +++ b/drivers/reset/reset-imx7.c
> @@ -364,6 +364,7 @@ static int imx7_reset_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct regmap_config config = { .name = "src" };
> const struct imx7_src_variant *variant = of_device_get_match_data(dev);
> + int ret;
>
> imx7src = devm_kzalloc(dev, sizeof(*imx7src), GFP_KERNEL);
> if (!imx7src)
> @@ -375,7 +376,9 @@ static int imx7_reset_probe(struct platform_device *pdev)
> dev_err(dev, "Unable to get imx7-src regmap");
> return PTR_ERR(imx7src->regmap);
> }
> - regmap_attach_dev(dev, imx7src->regmap, &config);
> + ret = regmap_attach_dev(dev, imx7src->regmap, &config);
> + if (ret)
> + return dev_err_probe(dev, ret, "regmap attach failed\n");
regmap_attach_dev() only returns -ENOMEM errors. The dev_err_probe() is
unnecessary here, as it does not print anything [1].
[1] 2f3cfd2f4b7c ("driver core: Make dev_err_probe() silent for -ENOMEM")
regards
Philipp
next prev parent reply other threads:[~2026-02-05 8:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-05 3:42 Chen Ni
2026-02-05 8:02 ` Philipp Zabel [this message]
2026-02-05 12:30 ` Markus Elfring
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=68979ef7dbd839e4e601bd579f2d3b199a0d350e.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=Frank.Li@nxp.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nichen@iscas.ac.cn \
--cc=s.hauer@pengutronix.de \
/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
all inboxes | Powered by JetHome®