Re: [PATCH v3 13/27] staging: iio: resolver: ad2s1210: rework gpios

From: Jonathan Cameron
Date: Thu Oct 05 2023 - 10:39:11 EST


On Sat, 30 Sep 2023 15:55:36 +0100
Jonathan Cameron <jic23@xxxxxxxxxx> wrote:

> On Fri, 29 Sep 2023 12:23:18 -0500
> David Lechner <dlechner@xxxxxxxxxxxx> wrote:
>
> > From: David Lechner <david@xxxxxxxxxxxxxx>
> >
> > From: David Lechner <dlechner@xxxxxxxxxxxx>
> >
> > - Remove "adi," prefix from gpio names.
> > - Sample gpio is now expected to be active low.
> > - Convert A0 and A1 gpios to "mode-gpios" gpio array.
> > - Convert RES0 and RES1 gpios to "resolution-gpios" gpio array.
> > - Remove extraneous lookup tables.
> > - Remove unused mode field from state struct.
> > - Swap argument order of ad2s1210_set_mode() while we are touching this.
> >
> > Signed-off-by: David Lechner <dlechner@xxxxxxxxxxxx>
> Applied,
0-day ran smatch on this and it picked up that a log isn't released in
an error path. I've fixed that up with a goto error_ret and will push out a
fresh testing branch for 0-day to take another look at.

...

> > @@ -546,7 +537,9 @@ static int ad2s1210_initial(struct ad2s1210_state *st)
> > int ret;
> >
> > mutex_lock(&st->lock);
> > - ad2s1210_set_resolution_pin(st);
> > + ret = ad2s1210_set_resolution_gpios(st, st->resolution);
> > + if (ret < 0)
Exiting with lock held. There is an error_ret label that releases the lock
so use that.

> > + return ret;
> >
> > /* Use default config register value plus resolution from devicetree. */
> > data = FIELD_PREP(AD2S1210_PHASE_LOCK_RANGE_44, 1);