[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251030095534.770-1-vulab@iscas.ac.cn>
Date: Thu, 30 Oct 2025 17:55:33 +0800
From: Haotian Zhang <vulab@...as.ac.cn>
To: Eddie James <eajames@...ux.ibm.com>,
Ninad Palsule <ninad@...ux.ibm.com>
Cc: linux-fsi@...ts.ozlabs.org,
linux-kernel@...r.kernel.org,
Haotian Zhang <vulab@...as.ac.cn>
Subject: [PATCH] fsi: master-hub: Fix of_node leak in probe error path
If the call to fsi_master_register() fails, the function exits
without releasing the of_node reference previously acquired via
of_node_get(). This results in an of_node reference count leak.
Add a call to of_node_put() under a new label to ensure the
reference is correctly released before the function returns.
Fixes: f6a2f8eb73f0 ("fsi: Match fsi slaves and engines to available dt nodes")
Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>
---
drivers/fsi/fsi-master-hub.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/fsi/fsi-master-hub.c b/drivers/fsi/fsi-master-hub.c
index 6568fed7db3c..e259ed1c17e0 100644
--- a/drivers/fsi/fsi-master-hub.c
+++ b/drivers/fsi/fsi-master-hub.c
@@ -241,7 +241,7 @@ static int hub_master_probe(struct device *dev)
rc = fsi_master_register(&hub->master);
if (rc)
- goto err_release;
+ goto err_free_node;
/* At this point, fsi_master_register performs the device_initialize(),
* and holds the sole reference on master.dev. This means the device
@@ -253,6 +253,8 @@ static int hub_master_probe(struct device *dev)
get_device(&hub->master.dev);
return 0;
+err_free_node:
+ of_node_put(hub->master.dev.of_node);
err_release:
fsi_slave_release_range(fsi_dev->slave, FSI_HUB_LINK_OFFSET,
FSI_HUB_LINK_SIZE * links);
--
2.50.1.windows.1
Powered by blists - more mailing lists