[PATCH] iio: adc: ade9000: move mutex init before IRQ registration

Antoniu Miclaus posted 1 patch 1 month, 1 week ago
drivers/iio/adc/ade9000.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[PATCH] iio: adc: ade9000: move mutex init before IRQ registration
Posted by Antoniu Miclaus 1 month, 1 week ago
Move devm_mutex_init() before ade9000_request_irq() calls so that
st->lock is initialized before any handler that depends on it can run.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
 drivers/iio/adc/ade9000.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/ade9000.c b/drivers/iio/adc/ade9000.c
index db085dc5e526..c62c6480dd0a 100644
--- a/drivers/iio/adc/ade9000.c
+++ b/drivers/iio/adc/ade9000.c
@@ -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;
 
-- 
2.43.0
Re: [PATCH] iio: adc: ade9000: move mutex init before IRQ registration
Posted by Andy Shevchenko 1 month, 1 week ago
On Fri, Feb 27, 2026 at 03:33:30PM +0200, Antoniu Miclaus wrote:
> 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).

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH] iio: adc: ade9000: move mutex init before IRQ registration
Posted by Jonathan Cameron 1 month, 1 week ago
On Sat, 28 Feb 2026 13:05:18 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Fri, Feb 27, 2026 at 03:33:30PM +0200, Antoniu Miclaus wrote:
> > 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).
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> 
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