Skip to contentSkip to conversation

cpuidle: qcom: Fix refcount leak in spm_cpuidle_register

PATCH New Miaoqian Lin 1 participant 1 message Mar 18, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpuidle: qcom: Fix refcount leak in spm_cpuidle_register

Fix a reference counter leak in spm_cpuidle_register() where of_node_put(cpu_node) was missing when of_parse_phandle() fails.

Fixes 60f3692b5f0b ("cpuidle: qcom_spm: Detach state machine from main SPM handling")
---
 drivers/cpuidle/cpuidle-qcom-spm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpuidle/cpuidle-qcom-spm.c +1 -1
index 3ab240e0e122..c9ab49b310fd 100644
@@ -96,12 +96,12 @@ static int spm_cpuidle_register(struct device *cpuidle_dev, int cpu)
 		return -ENODEV;
 
 	saw_node = of_parse_phandle(cpu_node, "qcom,saw", 0);
+	of_node_put(cpu_node);
 	if (!saw_node)
 		return -ENODEV;
 
 	pdev = of_find_device_by_node(saw_node);
 	of_node_put(saw_node);
-	of_node_put(cpu_node);
 	if (!pdev)
 		return -ENODEV;
 
Signature · 1 line
2.39.5 (Apple Git-154)