Re: [PATCH v3] iio: chemical: scd30: Use devm_mutex_init() over non-devm mutex_init()
From: Jonathan Cameron
Date: Sun Jun 14 2026 - 14:35:33 EST
On Sat, 6 Jun 2026 08:58:20 +0300
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> On Fri, Jun 05, 2026 at 07:42:04PM -0500, Maxwell Doose wrote:
> > The current code uses mutex_init() instead of devm_mutex_init(), which
> > is incorrect as the rest of the file uses the devm automatic resource
> > management API. Fix this so that the mutex is set up in the same way as
> > the rest of the device data structure.
>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
>
> ...
>
> > state->meas_interval = SCD30_MEAS_INTERVAL_DEFAULT;
> > state->command = command;
>
> + blank line here.
>
Tweaked and applied.
> > - mutex_init(&state->lock);
> > + ret = devm_mutex_init(dev, &state->lock);
> > + if (ret)
> > + return ret;
>