Re: [PATCH v5 06/10] iio: adc: ti-ads1015: drop unneeded < 0 error checks

From: Jonathan Cameron

Date: Sun Oct 18 2026 - 21:50:20 EST


On Wed, 30 Sep 2026 22:42:00 +0530
Archit Anant <architanant5@xxxxxxxxx> wrote:

> Several functions in the driver only return 0 on success
> or a negative error code on failure.
>
> Change the error checking to align with standard kernel
> coding style.
>
> Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
> Signed-off-by: Archit Anant <architanant5@xxxxxxxxx>
Hi Archit,

A patch I reviewed early today touched this same code, so
I'll give some related feedback!

> ---
> drivers/iio/adc/ti-ads1015.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
> index 34d3d31b5ddd..6637c42e0506 100644
> --- a/drivers/iio/adc/ti-ads1015.c
> +++ b/drivers/iio/adc/ti-ads1015.c
> @@ -539,7 +539,7 @@ static int __ads1015_read_info_raw(struct ads1015_data *data,
> return -EBUSY;
>
> ret = ads1015_set_power_state(data, true);

Can we get rid of this _set_power_state helper? It's entirely pointless now
the runtime pm code is a lot simpler than it was a few years back.

It is included in a series removing the return from the put that is on list
and I asked for that there as well. Note that once you do that
it will be easy to use the ACQUIRE_ magic for handling this so maybe jump
directly to that instead of having this change.

> - if (ret < 0)
> + if (ret)
> return ret;
>
> ret = ads1015_get_adc_result(data, chan->address, val);
> @@ -727,7 +727,7 @@ static int ads1015_enable_event_config(struct ads1015_data *data,
> return ret;
>
> ret = ads1015_set_power_state(data, true);
> - if (ret < 0)
> + if (ret)
> return ret;
>
> ads1015_event_channel_enable(data, chan->address, comp_mode);
> @@ -994,7 +994,7 @@ static int ads1015_probe(struct i2c_client *client)
> ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL,
> ads1015_trigger_handler,
> &ads1015_buffer_setup_ops);
> - if (ret < 0)
> + if (ret)
> return dev_err_probe(dev, ret,
> "iio triggered buffer setup failed\n");
>