Skip to contentSkip to conversation

arm: mach-rockchip: Add missing of_node_put

PATCH Superseded heliang 1 participant 1 message Jun 15, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

heliang

author
#0 lore raw

PATCH 1/1 arm: mach-rockchip: Add missing of_node_put

In rockchip_suspend_init, of_find_matching_node_and_match() will return a node pointer with refcount incremented. We should use of_node_put() in fail path or when the pointer is not used anymore.

---
 arch/arm/mach-rockchip/pm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/pm.c +3 -1
index 87389d9456b9..5db6a6c6c088 100644
@@ -310,6 +310,7 @@ void __init rockchip_suspend_init(void)
 	np = of_find_matching_node_and_match(NULL, rockchip_pmu_of_device_ids,
 					     &match);
 	if (!match) {
+		of_node_put(np);
 		pr_err("Failed to find PMU node\n");
 		return;
 	}
@@ -319,10 +320,11 @@ void __init rockchip_suspend_init(void)
 		ret = pm_data->init(np);
 
 		if (ret) {
+			of_node_put(np);
 			pr_err("%s: matches init error %d\n", __func__, ret);
 			return;
 		}
 	}
-
+	of_node_put(np);
 	suspend_set_ops(pm_data->ops);
 }
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel