Re: [PATCH v6 3/3] iio: adc: bcm_iproc_adc: Convert probe error handling to dev_err_probe()

Andy Shevchenko <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel
Organization Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo
Message-ID <[email protected]>
On Thu, Aug 06, 2026 at 08:09:02AM +0530, [email protected] 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 <[email protected]>

-- 
With Best Regards,
Andy Shevchenko
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.