Re: [PATCH] fix
From: Jonathan Cameron
Date: Sat May 25 2024 - 12:36:01 EST
On Wed, 22 May 2024 12:50:23 +0300
Alisa-Dariana Roman <alisadariana@xxxxxxxxx> wrote:
> ---
>
> Would this fix be alright, since writing something like if(!ret) may be
> confusing?
>
Looks fine to me. Squashed into original commit that I messed up.
Thanks for sorting this out.
Jonathan
> And regarding the comment, my bad, there is nothing wrong there.
>
> drivers/iio/adc/ad7192.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
> index 101afce49378..0789121236d6 100644
> --- a/drivers/iio/adc/ad7192.c
> +++ b/drivers/iio/adc/ad7192.c
> @@ -1101,14 +1101,12 @@ static int ad7194_parse_channels(struct iio_dev *indio_dev)
> ret = fwnode_property_read_u32_array(child, "diff-channels",
> ain, ARRAY_SIZE(ain));
> if (ret == 0) {
> - ret = ad7194_validate_ain_channel(dev, ain[0]);
> - if (ret)
> + if (!ad7194_validate_ain_channel(dev, ain[0]))
> return dev_err_probe(dev, -EINVAL,
> "Invalid AIN channel: %u\n",
> ain[0]);
>
> - ret = ad7194_validate_ain_channel(dev, ain[1]);
> - if (ret)
> + if (!ad7194_validate_ain_channel(dev, ain[1]))
> return dev_err_probe(dev, -EINVAL,
> "Invalid AIN channel: %u\n",
> ain[1]);
> @@ -1125,8 +1123,7 @@ static int ad7194_parse_channels(struct iio_dev *indio_dev)
> return dev_err_probe(dev, ret,
> "Missing channel property\n");
>
> - ret = ad7194_validate_ain_channel(dev, ain[0]);
> - if (ret)
> + if (!ad7194_validate_ain_channel(dev, ain[0]))
> return dev_err_probe(dev, -EINVAL,
> "Invalid AIN channel: %u\n",
> ain[0]);