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

Jonathan Cameron
2023-10-05T13:38:09Z

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

> On Fri, 29 Sep 2023 12:23:18 -0500
> David Lechner <dlechner@baylibre.com> wrote:
>
> > From: David Lechner <david@lechnology.com>
> >
> > From: David Lechner <dlechner@baylibre.com>
> >
> > - 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@baylibre.com>
> 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);