Re: [PATCH] iio: adc: ti-adc*: use dev_err_probe for probe time errors

From: David Lechner

Date: Tue Jun 16 2026 - 10:05:02 EST


On 6/16/26 8:05 AM, Prashant Rahul wrote:
> This simplifies error handling and ensures consistent error reporting.
> Also add missing error messages in a few probe paths where failures were
> previously returned without any diagnostics.
>
> Signed-off-by: Prashant Rahul <prashantrahul23@xxxxxxxxx>
> ---
> drivers/iio/adc/ti-adc081c.c | 10 ++++------
> drivers/iio/adc/ti-adc0832.c | 6 +++---
> drivers/iio/adc/ti-adc084s021.c | 3 +--
> drivers/iio/adc/ti-adc108s102.c | 2 +-
> drivers/iio/adc/ti-adc128s052.c | 2 +-
> drivers/iio/adc/ti-adc161s626.c | 6 +++---
> 6 files changed, 13 insertions(+), 16 deletions(-)

Please make one patch per file.

>
> diff --git a/drivers/iio/adc/ti-adc081c.c b/drivers/iio/adc/ti-adc081c.c
> index 33f82bdfeb94..f6ce23975b80 100644
> --- a/drivers/iio/adc/ti-adc081c.c
> +++ b/drivers/iio/adc/ti-adc081c.c
> @@ -174,26 +174,24 @@ static int adc081c_probe(struct i2c_client *client)
>
> err = regulator_enable(adc->ref);
> if (err < 0)
> - return err;
> + return dev_err_probe(&client->dev, err, "failed to enable regulator\n");
>
> err = devm_add_action_or_reset(&client->dev, adc081c_reg_disable,
> adc->ref);
> if (err)
> - return err;
> + return dev_err_probe(&client->dev, err, "failed to register cleanup action\n");

Please don't add new error messages. If there is a really good
reason to, please do that in a separate patch with a justification
as to why it is needed.

In this particular case, the only error is -ENOMEM, which we never
have an error message for.

Above, for regulator_enable(), an error is already printed in many cases
when it fails, so needing to add an additional error message is questionable.

The same comments apply to the rest of the changes as well. Unless you actually
hit one of these errors and found it difficult to troubleshoot without an
additional message, then it probably isn't an improvement.