mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: admv1013: initialize callback mutex before registering notifier
@ 2026-08-18 14:28 Runyu Xiao
  2026-08-18 15:31 ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Runyu Xiao @ 2026-08-18 14:28 UTC (permalink / raw)
  To: Antoniu Miclaus
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sa, Andy Shevchenko, linux-iio, linux-kernel,
	stable, Runyu Xiao, Jianhao Xu

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.

Fixes: da35a7b526d9 ("iio: frequency: admv1013: add support for ADMV1013")
Cc: stable@vger.kernel.org
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
 drivers/iio/frequency/admv1013.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/frequency/admv1013.c b/drivers/iio/frequency/admv1013.c
index d8e8d541990f..932f094f2b04 100644
--- a/drivers/iio/frequency/admv1013.c
+++ b/drivers/iio/frequency/admv1013.c
@@ -594,12 +594,12 @@ static int admv1013_probe(struct spi_device *spi)
 				     "failed to get the LO input clock\n");
 
 	st->nb.notifier_call = admv1013_freq_change;
+	mutex_init(&st->lock);
+
 	ret = devm_clk_notifier_register(&spi->dev, st->clkin, &st->nb);
 	if (ret)
 		return ret;
 
-	mutex_init(&st->lock);
-
 	ret = admv1013_init(st, vcm_uv);
 	if (ret) {
 		dev_err(&spi->dev, "admv1013 init failed\n");
-- 
2.34.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-23  0:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-18 14:28 [PATCH] iio: admv1013: initialize callback mutex before registering notifier Runyu Xiao
2026-08-18 15:31 ` Andy Shevchenko
2026-08-19  0:46   ` Jonathan Cameron
2026-08-19 14:17     ` [PATCH v2] " Runyu Xiao
2026-08-23  0:02       ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®