Re: [PATCH v6 3/3] iio: adc: bcm_iproc_adc: Convert probe error handling to dev_err_probe()
From: Andy Shevchenko
Date: Mon Aug 10 2026 - 04:36:47 EST
On Thu, Aug 06, 2026 at 08:09:02AM +0530, mdshahid03@xxxxxxxxx wrote:
> Replace open-coded dev_err() followed by return with dev_err_probe()
> for probe failures that immediately return.
>
> Leave error paths that jump to cleanup labels unchanged to reduce code
> churn. These paths will be converted separately together with the
> planned devm-managed cleanup using devm_add_action_or_reset().
...
> adc_priv->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
> "adc-syscon");
Size note: the above can be also amended (since you have a 'dev') to
adc_priv->regmap = syscon_regmap_lookup_by_phandle(dev->of_node,
"adc-syscon");
But we can go even further (in a separate patch) and move it to
adc_priv->regmap = syscon_regmap_lookup_by_phandle(dev_of_node(dev),
"adc-syscon");
...
> adc_priv->adc_clk = devm_clk_get(dev, "tsc_clk");
> - if (IS_ERR(adc_priv->adc_clk)) {
> - dev_err(&pdev->dev,
> - "failed getting clock tsc_clk\n");
> - ret = PTR_ERR(adc_priv->adc_clk);
> - return ret;
> - }
> + if (IS_ERR(adc_priv->adc_clk))
> + return dev_err_probe(dev, PTR_ERR(adc_priv->adc_clk),
> + "failed getting clock tsc_clk\n");
> ret = clk_prepare_enable(adc_priv->adc_clk);
> - if (ret) {
> - dev_err(&pdev->dev,
> - "clk_prepare_enable failed %d\n", ret);
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(dev, ret, "failed to enable clock\n");
This will be less churn if the previous (new) patch will convert this to use
devn_clk_get_enabled(). But if Jonathan is okay with this patch as is, you
can take my
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
--
With Best Regards,
Andy Shevchenko