[PATCH] ata: ahci_brcm: fix refcount leak in brcm_ahci_probe()
From: Wentao Liang
Date: Wed Jun 03 2026 - 06:31:56 EST
When reset_control_deassert() fails in brcm_ahci_probe(), the
function returns without calling reset_control_rearm() on the
previously asserted shared reset control. This leaves the
triggered count incremented, leaking the reset control reference.
All other error paths after the reset_control_reset() call properly
reach the out_reset label which performs the rearm. Rework the
deassert error path to go through out_reset to restore the
triggered count and ensure the reference is released properly.
Cc: stable@xxxxxxxxxxxxxxx
Fixes: 1a0600d112e3 ("ata: ahci_brcm: Perform reset after obtaining resources")
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/ata/ahci_brcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ata/ahci_brcm.c b/drivers/ata/ahci_brcm.c
index 38c63d73d210..b58343f027cf 100644
--- a/drivers/ata/ahci_brcm.c
+++ b/drivers/ata/ahci_brcm.c
@@ -492,7 +492,7 @@ static int brcm_ahci_probe(struct platform_device *pdev)
return ret;
ret = reset_control_deassert(priv->rcdev_ahci);
if (ret)
- return ret;
+ goto out_reset;
ret = ahci_platform_enable_clks(hpriv);
if (ret)
--
2.34.1