Skip to contentSkip to conversation

soundwire: irq: Invalidate slave->irq before disposing the mapping

PATCH In review Richard Fitzgerald 1 participant 2 messages Aug 31

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soundwire: irq: Invalidate slave->irq before disposing the mapping

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")
---
 drivers/soundwire/irq.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/soundwire/irq.c +5 -1
index f18be37efef8e..f0de5a5e5eb43 100644
@@ -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)
Signature · 1 line
2.47.3
#1 lore raw
Quoted 6 lines · Richard Fitzgerald

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.