Re: [PATCH] iio: adc: Correct conditional logic for store mode
From: Gabriel Shahrouzi
Date: Mon Apr 14 2025 - 11:40:46 EST
On Mon, Apr 14, 2025 at 11:02 AM David Lechner <dlechner@xxxxxxxxxxxx> wrote:
>
> On 4/14/25 9:59 AM, David Lechner wrote:
> > On 4/14/25 9:09 AM, Gabriel Shahrouzi wrote:
> >> The mode setting logic in ad7816_store_mode was reversed due to
> >> incorrect handling of the strcmp return value. strcmp returns 0 on
> >> match, so the `if (strcmp(buf, "full"))` block executed when the
> >> input was not "full".
> >>
> >> This resulted in "full" setting the mode to AD7816_PD (power-down) and
> >> other inputs setting it to AD7816_FULL.
> >>
> >> Fix this by checking it against 0 to correctly check for "full" and
> >> "power-down", mapping them to AD7816_FULL and AD7816_PD respectively.
> >>
> >
> > Sounds like we need a Fixes: tag here that reference the commit
> > that introduced the bug.
Sounds good. Included the fixes tag and CC'd stable@xxxxxxxxxxxxxxx.
> >
> >> Signed-off-by: Gabriel Shahrouzi <gshahrouzi@xxxxxxxxx>
> >> ---
>
> There is also a typo in your email address in the cc: gshahrozui@xxxxxxxxx
Whoops - I'll update that.
I just realized I didn't update the version for the second patch
correctly so I'll send in a new one.