[PATCH] mfd: twl4030-irq: Fix a lock leak in twl4030_sih_bus_sync_unlock()
From: Bart Van Assche
Date: Mon Oct 26 2026 - 15:56:09 EST
If reading the EDR registers fails, twl4030_sih_bus_sync_unlock()
returns without unlocking agent->irq_lock. Fix this by jumping to a new
label in front of the mutex_unlock() call. This bug has been detected by
the Clang thread-safety analyzer.
Fixes: 2f2a7d5ef764 ("mfd: Drop twl4030-irq's edge_work")
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
drivers/mfd/twl4030-irq.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
index 06809f68b007..9ca000c5c779 100644
--- a/drivers/mfd/twl4030-irq.c
+++ b/drivers/mfd/twl4030-irq.c
@@ -513,7 +513,7 @@ static void twl4030_sih_bus_sync_unlock(struct irq_data *data)
if (status) {
pr_err("twl4030: %s, %s --> %d\n", __func__,
"read", status);
- return;
+ goto unlock;
}
/* Modify only the bits we know must change */
@@ -542,6 +542,7 @@ static void twl4030_sih_bus_sync_unlock(struct irq_data *data)
"write", status);
}
+unlock:
mutex_unlock(&agent->irq_lock);
}