Re: [PATCH v6 3/3] iio: adc: bcm_iproc_adc: Convert probe error handling to dev_err_probe()
From: Jonathan Cameron
Date: Sat Aug 15 2026 - 21:15:52 EST
On Mon, 10 Aug 2026 11:32:26 +0300
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> 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>
Too much in my backlog for me to keep track so I'll merge what we have
here and a follow up bit of devm_ work can be a separate series (this
time - look for similar opportunities if you do similar work
in future!)
Series applied to the testing branch of iio.git.
Jonathan
>