Skip to contentSkip to conversation

iio: adc: ade9000: move mutex init before IRQ registration

PATCH Applied Antoniu Miclaus 3 participants 3 messages Feb 27 – Feb 28

Subsystems (3)
lore
Share & tools
lore

Antoniu Miclaus

author maintainer
#0 lore raw

PATCH 1/1 iio: adc: ade9000: move mutex init before IRQ registration

Move devm_mutex_init() before ade9000_request_irq() calls so that st->lock is initialized before any handler that depends on it can run.

---
 drivers/iio/adc/ade9000.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iio/adc/ade9000.c +4 -4
index db085dc5e526..c62c6480dd0a 100644
@@ -1706,19 +1706,19 @@ static int ade9000_probe(struct spi_device *spi)
 
 	init_completion(&st->reset_completion);
 
-	ret = ade9000_request_irq(dev, "irq0", ade9000_irq0_thread, indio_dev);
+	ret = devm_mutex_init(dev, &st->lock);
 	if (ret)
 		return ret;
 
-	ret = ade9000_request_irq(dev, "irq1", ade9000_irq1_thread, indio_dev);
+	ret = ade9000_request_irq(dev, "irq0", ade9000_irq0_thread, indio_dev);
 	if (ret)
 		return ret;
 
-	ret = ade9000_request_irq(dev, "dready", ade9000_dready_thread, indio_dev);
+	ret = ade9000_request_irq(dev, "irq1", ade9000_irq1_thread, indio_dev);
 	if (ret)
 		return ret;
 
-	ret = devm_mutex_init(dev, &st->lock);
+	ret = ade9000_request_irq(dev, "dready", ade9000_dready_thread, indio_dev);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Antoniu Miclaus

Move devm_mutex_init() before ade9000_request_irq() calls so that st->lock is initialized before any handler that depends on it can run.

Sounds good. The technique to reproduce this (in case you have a HWr to make sure probe runs) the kernel configuration should have CONFIG_DEBUG_SHIRQ=y (and in some cases a tweak in the code to flag IRQ as shared).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer Applied
#2 lore raw
Quoted 11 lines · On Sat, 28 Feb 2026 13:05:18 +0200 Andy Shevchenko…
Quoted 2 lines · Antoniu Miclaus

Move devm_mutex_init() before ade9000_request_irq() calls so that st->lock is initialized before any handler that depends on it can run.

Sounds good. The technique to reproduce this (in case you have a HWr to make sure probe runs) the kernel configuration should have CONFIG_DEBUG_SHIRQ=y (and in some cases a tweak in the code to flag IRQ as shared).

Applied as a fix, so I added a Fixes tag and +CC stable.

Whilst hard to hit it is is always good to ensure we are safe against spurious interrupts.

thanks,

Jonathan