Re: [PATCH v9 08/11] iio: adc: hx711: split variable assignments in hx711_read and hx711_reset
From: Piyush Patle
Date: Sat May 23 2026 - 22:48:03 EST
On Wed, May 20, 2026 at 3:54 PM Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
>
> On Tue, 19 May 2026 03:32:24 +0530
> Piyush Patle <piyushpatle228@xxxxxxxxx> wrote:
>
> > Separate the initial value assignments from the declarations in
> > hx711_read() and hx711_reset().
> >
> > This is a small preparatory cleanup before the later loop-iterator and
> > variant-specific changes adjust the local variable layout in these
> > functions.
> >
> > No functional change.
> >
> > Signed-off-by: Piyush Patle <piyushpatle228@xxxxxxxxx>
> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
> > ---
> > No change from v8.
> > drivers/iio/adc/hx711.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
> > index 30e1ce321747..9e5cafa1e307 100644
> > --- a/drivers/iio/adc/hx711.c
> > +++ b/drivers/iio/adc/hx711.c
> > @@ -159,9 +159,10 @@ static int hx711_read(struct hx711_data *hx711_data, int trailing_pulses)
> > {
> > int i, ret;
> > int value = 0;
> > - int val = gpiod_get_value(hx711_data->gpiod_dout);
> > + int val;
> >
> > /* we double check if it's really down */
> > + val = gpiod_get_value(hx711_data->gpiod_dout);
> > if (val)
> > return -EIO;
> >
> > @@ -204,7 +205,9 @@ static int hx711_wait_for_ready(struct hx711_data *hx711_data)
> >
> > static int hx711_reset(struct hx711_data *hx711_data)
> > {
> > - int val = hx711_wait_for_ready(hx711_data);
> > + int val;
> > +
> > + val = hx711_wait_for_ready(hx711_data);
> >
>
> Trivial but no blank line here. We want that error
> check closely associated with the thing that set val.
>
> > if (val) {
> > /*
>
ack! will fix in v10