[PATCH] soc: sunxi: sram: Release node references when claims fail
From: Zhu Jun
Date: Wed Nov 11 2026 - 21:41:36 EST
When claiming an SRAM region fails, sunxi_sram_claim() leaves the phandle
iteration before it can release the current node. The rollback loop also
parses each previously claimed region without releasing the returned
node reference.
Put the iterator's current node before rollback and release each node
after undoing its claim.
OpenAI Codex assisted with analysis and patch preparation.
Fixes: be99eb936b4f ("soc: sunxi: sram: Support claiming multiple regions per device")
Signed-off-by: Zhu Jun <zhujun2@xxxxxxxxxxxxxxxxxxxx>
---
drivers/soc/sunxi/sunxi_sram.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c
index 2ccaeacf8c70..4667661b2003 100644
--- a/drivers/soc/sunxi/sunxi_sram.c
+++ b/drivers/soc/sunxi/sunxi_sram.c
@@ -294,12 +294,14 @@ int sunxi_sram_claim(struct device *dev)
return 0;
err:
+ of_node_put(it.node);
while (count--) {
struct of_phandle_args args;
of_parse_phandle_with_fixed_args(dev->of_node, SUNXI_SRAM_PROP,
SUNXI_SRAM_CELLS, count, &args);
sunxi_sram_release_one(args.np, args.args[0]);
+ of_node_put(args.np);
}
return err;
--
2.51.0