drivers/reset/reset-imx7.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
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>
---
Changes in v2:
- Simplify error handling
---
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..a1cca926085b 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 ret;
imx7src->rcdev.owner = THIS_MODULE;
imx7src->rcdev.nr_resets = variant->signals_num;
--
2.25.1
On Fri, Feb 06, 2026 at 01:01:09PM +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>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Changes in v2:
> - Simplify error handling
> ---
> 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..a1cca926085b 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 ret;
>
> imx7src->rcdev.owner = THIS_MODULE;
> imx7src->rcdev.nr_resets = variant->signals_num;
> --
> 2.25.1
>
> Add error checking for regmap_attach_dev() call in imx7_reset_probe() > function to ensure proper error propagation. … * Were any source code analysis tools involved here? * Did anything hinder to add any tags (like “Fixes” and “Cc”) accordingly? Regards, Markus
On Fr, 2026-02-06 at 13:01 +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> Thank you, Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> regards Philipp
© 2016 - 2026 Red Hat, Inc.