Re: [PATCH v2 11/12] iio: dac: ad5686: write_raw: use guard(mutex)()

From: Jonathan Cameron

Date: Sun Jun 14 2026 - 13:39:19 EST


On Tue, 9 Jun 2026 17:17:58 -0500
Maxwell Doose <m32285159@xxxxxxxxx> wrote:

> On Tue, 9 Jun 2026 17:13:02 -0500
> Maxwell Doose <m32285159@xxxxxxxxx> wrote:
>
> > On Tue, 09 Jun 2026 11:13:06 +0100
> > Rodrigo Alencar via B4 Relay
> > <devnull+rodrigo.alencar.analog.com@xxxxxxxxxx> wrote:
> >
> > > From: Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx>
> > >
> > > Use guarded mutex lock to facilitate code review when adding new
> > > attributes. This will allow for early returns, avoiding error-prone
> > > locking and unlocking in error paths. Gain-control support will add
> > > the scale attribute.
> > >
> > > Signed-off-by: Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx>
> > > ---
> > > drivers/iio/dac/ad5686.c | 14 +++++---------
> > > 1 file changed, 5 insertions(+), 9 deletions(-)
> > >
> >
> > I agree with Joshua on this, linux/cleanup.h should definitely be
> > included. However I don't think sending a v3 is worth the trouble
> > (Jonathan may tweak while applying but I wouldn't count on it), so with
> > or without:
> >
> > Reviewed-by: Maxwell Doose <m32285159@xxxxxxxxx>
> >
>
> Although I will note that it appears that you haven't converted all of
> the locks to guard(mutex)(). While its only in two spots you should
> probably convert all of them. Either way, patch is obviously correct
> (besides IWYU), so I still stand by my rb.
>

As far as I'm concerned it is fine to mix and match between guard() and
non guard() if there are places where it is too messy to use guard()

Sometimes it feels nice from a completeness point of view but I'm
definitely not insisting on it!

Jonathan