[PATCH] drivers: bus: Fix resource leaks in for_each_available_child_of_node loop

Lu Hongfei luhongfei at vivo.com
Thu Jul 6 00:13:09 PDT 2023


Ensure child node references are decremented properly in
the error path.

Signed-off-by: Lu Hongfei <luhongfei at vivo.com>
---
 drivers/bus/imx-weim.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c
index 52a5d0447390..d05472f7c20f 100644
--- a/drivers/bus/imx-weim.c
+++ b/drivers/bus/imx-weim.c
@@ -251,6 +251,7 @@ static int weim_parse_dt(struct platform_device *pdev)
 		else
 			have_child = 1;
 	}
+	of_node_put(child);
 
 	if (have_child)
 		ret = of_platform_default_populate(pdev->dev.of_node,
-- 
2.39.0




More information about the linux-arm-kernel mailing list