[PATCH] soc: fsl: qbman: Release the private memory node reference

Zhu Jun zhujun2 at cmss.chinamobile.com
Wed Nov 11 18:31:19 PST 2026


qbman_init_private_mem() obtains a node reference through
of_parse_phandle() or of_find_compatible_node(), but never releases it.
The reference leaks on successful initialization and on errors after the
lookup.

Use automatic cleanup to release the reference on every return path once
the reserved memory lookup and any reg property update are complete.

OpenAI Codex assisted with analysis and patch preparation.

Fixes: 42d0349784c7 ("soc/fsl/qbman: Add common routine for QBMan private allocations")
Signed-off-by: Zhu Jun <zhujun2 at cmss.chinamobile.com>
---
 drivers/soc/fsl/qbman/dpaa_sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/fsl/qbman/dpaa_sys.c b/drivers/soc/fsl/qbman/dpaa_sys.c
index 3504ff557231..e9c37c45dd58 100644
--- a/drivers/soc/fsl/qbman/dpaa_sys.c
+++ b/drivers/soc/fsl/qbman/dpaa_sys.c
@@ -37,7 +37,7 @@
 int qbman_init_private_mem(struct device *dev, int idx, const char *compat,
 			   dma_addr_t *addr, size_t *size)
 {
-	struct device_node *mem_node;
+	struct device_node *mem_node __free(device_node) = NULL;
 	struct reserved_mem *rmem;
 	int err;
 	__be32 *res_array;
-- 
2.51.0






More information about the linux-arm-kernel mailing list