Skip to contentSkip to conversation

mailbox: th1520: fix clock imbalance on probe failure

PATCH In review Johan Hovold 3 participants 7 messages Oct 17, 2025 – Dec 1, 2025

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

PATCH 1/1 mailbox: th1520: fix clock imbalance on probe failure

The purpose of the devm_add_action_or_reset() helper is to call the action function in case adding an action ever fails so drop the clock disable from the error path to avoid disabling the clocks twice.

Fixes 5d4d263e1c6b ("mailbox: Introduce support for T-head TH1520 Mailbox driver")
Cc Michal Wilczynski <[email protected]>
---
 drivers/mailbox/mailbox-th1520.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mailbox/mailbox-th1520.c +1 -3
index a6b2aa9ae952..626957c2e435 100644
@@ -435,10 +435,8 @@ static int th1520_mbox_probe(struct platform_device *pdev)
 	}
 
 	ret = devm_add_action_or_reset(dev, th1520_disable_clk, priv);
-	if (ret) {
-		clk_bulk_disable_unprepare(ARRAY_SIZE(priv->clocks), priv->clocks);
+	if (ret)
 		return ret;
-	}
 
 	/*
 	 * The address mappings in the device tree align precisely with those
Signature · 1 line
2.49.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Johan Hovold

The purpose of the devm_add_action_or_reset() helper is to call the action function in case adding an action ever fails so drop the clock disable from the error path to avoid disabling the clocks twice.

Fixes 5d4d263e1c6b ("mailbox: Introduce support for T-head TH1520 Mailbox driver")
Cc Michal Wilczynski <[email protected]>
---
 drivers/mailbox/mailbox-th1520.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mailbox/mailbox-th1520.c +0 -0
index a6b2aa9ae952..626957c2e435 100644
@@ -435,10 +435,8 @@ static int th1520_mbox_probe(struct platform_device *pdev)
 	}

drivers/mailbox/mailbox-th1520.c static int th1520_mbox_probe(struct platform_device *pdev) · line 442

Quoted 10 lines
drivers/mailbox/mailbox-th1520.c +1 -3
 
 	ret = devm_add_action_or_reset(dev, th1520_disable_clk, priv);
-	if (ret) {
-		clk_bulk_disable_unprepare(ARRAY_SIZE(priv->clocks), priv->clocks);
+	if (ret)
 		return ret;
-	}
 
 	/*
 	 * The address mappings in the device tree align precisely with those

Hi,
Thanks for your fix. I believe it is correct as devm_add_action_or_reset will call th1520_disable_clk on failure, like you noticed.

Best regards,

Signature · 1 line
Michal Wilczynski <[email protected]>
#2 lore raw
In reply to Johan Hovold
Quoted 8 lines · Johan Hovold

The purpose of the devm_add_action_or_reset() helper is to call the action function in case adding an action ever fails so drop the clock disable from the error path to avoid disabling the clocks twice.

Fixes 5d4d263e1c6b ("mailbox: Introduce support for T-head TH1520 Mailbox driver")
Cc Michal Wilczynski <[email protected]>

---

Can this one be picked up for 6.19?

Johan

maintainer Acked-by on v1 1/1
#6 lore raw
In reply to Johan Hovold
Quoted 30 lines · Johan Hovold

The purpose of the devm_add_action_or_reset() helper is to call the action function in case adding an action ever fails so drop the clock disable from the error path to avoid disabling the clocks twice.

Fixes 5d4d263e1c6b ("mailbox: Introduce support for T-head TH1520 Mailbox driver")
Cc Michal Wilczynski <[email protected]>
---
 drivers/mailbox/mailbox-th1520.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mailbox/mailbox-th1520.c +1 -3
index a6b2aa9ae952..626957c2e435 100644
@@ -435,10 +435,8 @@ static int th1520_mbox_probe(struct platform_device *pdev)
 	}
 
 	ret = devm_add_action_or_reset(dev, th1520_disable_clk, priv);
-	if (ret) {
-		clk_bulk_disable_unprepare(ARRAY_SIZE(priv->clocks), priv->clocks);
+	if (ret)
 		return ret;
-	}
 
 	/*
 	 * The address mappings in the device tree align precisely with those
Signature · 1 line
2.49.1

Jassi - are you able to take this through your mailbox tree?

Thanks,
Drew

#3 lore raw
In reply to Johan Hovold
Quoted 11 lines · Johan Hovold
Quoted 8 lines · Johan Hovold

The purpose of the devm_add_action_or_reset() helper is to call the action function in case adding an action ever fails so drop the clock disable from the error path to avoid disabling the clocks twice.

Fixes 5d4d263e1c6b ("mailbox: Introduce support for T-head TH1520 Mailbox driver")
Cc Michal Wilczynski <[email protected]>

---

Can this one be picked up for 6.19?

It's been another month so sending another reminder. Can this one be picked up for 6.19?

Johan

maintainer
#4 lore raw
Quoted 11 lines · Johan Hovold
Quoted 10 lines · Johan Hovold
Quoted 8 lines · Johan Hovold

The purpose of the devm_add_action_or_reset() helper is to call the action function in case adding an action ever fails so drop the clock disable from the error path to avoid disabling the clocks twice.

Fixes 5d4d263e1c6b ("mailbox: Introduce support for T-head TH1520 Mailbox driver")
Cc Michal Wilczynski <[email protected]>

---

Quoted 6 lines
Quoted 1 line

Can this one be picked up for 6.19?

It's been another month so sending another reminder. Can this one be picked up for 6.19?

Johan

It looks like this is now in the 6.18-rc7 PR from Jassi :)

https://lore.kernel.org/all/CABb+yY2GeWHWeASzemit8XvgvHg=Cse+46CqF3KJfsBXNPEBAw@mail.gmail.com/

-Drew

#5 lore raw
Quoted 12 lines · Drew Fustini
Quoted 11 lines · Johan Hovold
Quoted 10 lines · Johan Hovold
Quoted 8 lines · Johan Hovold

The purpose of the devm_add_action_or_reset() helper is to call the action function in case adding an action ever fails so drop the clock disable from the error path to avoid disabling the clocks twice.

Fixes 5d4d263e1c6b ("mailbox: Introduce support for T-head TH1520 Mailbox driver")
Cc Michal Wilczynski <[email protected]>

---

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Can this one be picked up for 6.19?

It's been another month so sending another reminder. Can this one be picked up for 6.19?

It looks like this is now in the 6.18-rc7 PR from Jassi :)

https://lore.kernel.org/all/CABb+yY2GeWHWeASzemit8XvgvHg=Cse+46CqF3KJfsBXNPEBAw@mail.gmail.com/

Yes, indeed, it made it into 6.18. Thanks!

Johan