Re: [PATCH v2 02/15] iio: adc: rzg2l_adc: Convert dev_err() to dev_err_probe()

Jonathan Cameron
2024-12-07T18:11:11Z

On Fri, 6 Dec 2024 13:13:24 +0200
Claudiu <claudiu.beznea@tuxon.dev> wrote:

> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> Convert all occurrences of dev_err() in the probe path to dev_err_probe().
> This improves readability and simplifies the code.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Hi Claudiu,

> + if (IS_ERR(adc->presetn))
> + return dev_err_probe(dev, PTR_ERR(adc->presetn), "failed to get presetn\n");
>
> ret = reset_control_deassert(adc->adrstn);
> - if (ret) {
> - dev_err(&pdev->dev, "failed to deassert adrstn pin, %d\n", ret);
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(&pdev->dev, ret, "failed to deassert adrstn pin, %d\n", ret);

Take a closer look at the implementation of dev_err_probe().
It already prints the return code (where appropriate) and in a pretty text form
which is easier to read. So we should not print it again.

I'd also prefer wrapping some of the longer lines in here a little earlier. For IIO
I still prefer to stay under 80 chars or only a little over it where it doesn't
hurt readability.

Jonathan