Re: [PATCH v6 08/11] iio: adc: hx711: split variable assignments in hx711_read and hx711_reset
From: Andy Shevchenko
Date: Mon May 04 2026 - 11:46:45 EST
On Sun, May 03, 2026 at 05:39:37PM +0530, Piyush Patle 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.
...
> int i, ret;
> int value = 0;
> - int val = gpiod_get_value(hx711_data->gpiod_dout);
> + int val;
> +
> + val = gpiod_get_value(hx711_data->gpiod_dout);
This line should be coupled with the conditional
>
> /* we double check if it's really down */
> if (val)
/* we double check if it's really down */
val = gpiod_get_value(hx711_data->gpiod_dout);
if (val)
...
> 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);
>
> if (val) {
Ditto.
val = hx711_wait_for_ready(hx711_data);
if (val) {
--
With Best Regards,
Andy Shevchenko