[PATCH] fpga: altera-hps2fpga: Fix reset control leak
From: Xiangwu Lai
Date: Mon Nov 02 2026 - 20:42:56 EST
alt_fpga_bridge_probe() acquires the bridge reset control with
of_reset_control_get_exclusive_by_index(), which is not
device-managed. None of the probe error paths (l3regs lookup
failure, missing clock, clock enable failure, bridge registration
failure) release it, and alt_fpga_bridge_remove() does not call
reset_control_put() either, so the reset control reference leaks both
on a failed probe and on every bind/unbind cycle.
Use devm_reset_control_get_exclusive_by_index() so the reset control
is released automatically when the driver is unbound or the probe
fails.
Fixes: e5f8efa5c8bf ("ARM: socfpga: fpga bridge driver support")
Signed-off-by: Xiangwu Lai <laixiangwu@xxxxxxxxxxxxxxxxxxxx>
---
drivers/fpga/altera-hps2fpga.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/fpga/altera-hps2fpga.c b/drivers/fpga/altera-hps2fpga.c
index f2f125068..6d9798bb9 100644
--- a/drivers/fpga/altera-hps2fpga.c
+++ b/drivers/fpga/altera-hps2fpga.c
@@ -134,8 +134,7 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev)
priv = (struct altera_hps2fpga_data *)device_get_match_data(dev);
- priv->bridge_reset = of_reset_control_get_exclusive_by_index(dev->of_node,
- 0);
+ priv->bridge_reset = devm_reset_control_get_exclusive_by_index(dev, 0);
if (IS_ERR(priv->bridge_reset)) {
dev_err(dev, "Could not get %s reset control\n", priv->name);
return PTR_ERR(priv->bridge_reset);