[PATCH] soundwire: irq: Invalidate slave->irq before disposing the mapping

Richard Fitzgerald posted 1 patch 3 weeks, 5 days ago
drivers/soundwire/irq.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
[PATCH] soundwire: irq: Invalidate slave->irq before disposing the mapping
Posted by Richard Fitzgerald 3 weeks, 5 days ago
In sdw_irq_dispose_mapping() invalidate the value in slave->irq before
calling irq_dispose_mapping().

This fixes the potential problem with the original code that slave->irq
was left with the value of the disposed mapping, so it looked like it
was still a valid IRQ.

Fixes: a5fef9baa87f ("soundwire: bus: Move irq mapping cleanup into devres")
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
 drivers/soundwire/irq.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/soundwire/irq.c b/drivers/soundwire/irq.c
index f18be37efef8e..f0de5a5e5eb43 100644
--- a/drivers/soundwire/irq.c
+++ b/drivers/soundwire/irq.c
@@ -49,8 +49,12 @@ void sdw_irq_delete(struct sdw_bus *bus)
 static void sdw_irq_dispose_mapping(void *data)
 {
 	struct sdw_slave *slave = data;
+	int irq = slave->irq;
 
-	irq_dispose_mapping(slave->irq);
+	slave->irq = 0;
+
+	if (irq)
+		irq_dispose_mapping(irq);
 }
 
 void sdw_irq_create_mapping(struct sdw_slave *slave)
-- 
2.47.3
Re: [PATCH] soundwire: irq: Invalidate slave->irq before disposing the mapping
Posted by Richard Fitzgerald 3 weeks, 5 days ago
On 31/08/2026 12:57 pm, Richard Fitzgerald wrote:
> In sdw_irq_dispose_mapping() invalidate the value in slave->irq before
> calling irq_dispose_mapping().
> 
> This fixes the potential problem with the original code that slave->irq
> was left with the value of the disposed mapping, so it looked like it
> was still a valid IRQ.

Actually, ignore this patch.
There are more problems with the validity of slave->irq and this isn't
really tackling it fully.