Re: [PATCH v3] iio: chemical: scd30: Use devm_mutex_init() over non-devm mutex_init()
From: Andy Shevchenko
Date: Sat Jun 06 2026 - 02:00:16 EST
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.
> - mutex_init(&state->lock);
> + ret = devm_mutex_init(dev, &state->lock);
> + if (ret)
> + return ret;
--
With Best Regards,
Andy Shevchenko