Re: [PATCH v2 2/4] iio: adc: ti-ads7950: do not clobber gpio state in ti_ads7950_get()
From: Andy Shevchenko
Date: Thu Feb 19 2026 - 02:56:11 EST
On Wed, Feb 18, 2026 at 06:29:26PM -0800, Dmitry Torokhov wrote:
> GPIO state was inadvertently overwritten by the result of sip_sync,
sip?
> reuniting in ti_ads7950_get() only returning 0 as gpio state (or error).
GPIO
> Fix this by introducing a separate variable to hold the state.
...
> - int ret;
> + int ret = 0;
This kind of assignment is harder to maintain, because it leaves a room for
subtle mistakes (when it's reused by a newly injected code, quite similar,
actually, to what this change tries to address). Please, decouple definition
and assignment.
> + bool state;
Not sure about this (yes, I know it was suggested). I would leave it still
the same type as one that is returned by the function or a compatible one
that is the same as st->* (if the used ones are all of the same type).
--
With Best Regards,
Andy Shevchenko