Re: [PATCH] iio: admv1013: initialize callback mutex before registering notifier

From: Andy Shevchenko

Date: Tue Aug 18 2026 - 11:35:44 EST


On Tue, Aug 18, 2026 at 10:28:11PM +0800, Runyu Xiao wrote:
> admv1013_probe() registers a clock notifier whose callback takes
> st->lock on POST_RATE_CHANGE. Initialize the mutex before
> devm_clk_notifier_register() so the callback cannot observe an
> uninitialized lock during probe.

...

> st->nb.notifier_call = admv1013_freq_change;

> + mutex_init(&st->lock);
> +

Make it also to be devm_mutex_init().

> ret = devm_clk_notifier_register(&spi->dev, st->clkin, &st->nb);
> if (ret)
> return ret;

--
With Best Regards,
Andy Shevchenko