[PATCH 09/10] soc: qcom: spm: Use __cleanup() for device_node pointers
From: Kathiravan Thirumoorthy
Date: Sun Nov 16 2025 - 23:54:44 EST
Apply the __cleanup() attribute to device_node pointers to simplify
resource management and remove explicit of_node_put() calls.
Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@xxxxxxxxxxxxxxxx>
---
drivers/soc/qcom/spm.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/soc/qcom/spm.c b/drivers/soc/qcom/spm.c
index f75659fff2874fb6a29c48ceee862b05b1ba5802..a87a8593a8b7fb2c62b14eaa9c96f46fc5eba877 100644
--- a/drivers/soc/qcom/spm.c
+++ b/drivers/soc/qcom/spm.c
@@ -391,7 +391,8 @@ static int spm_get_cpu(struct device *dev)
bool found;
for_each_possible_cpu(cpu) {
- struct device_node *cpu_node, *saw_node;
+ struct device_node *cpu_node __free(device_node) = NULL;
+ struct device_node *saw_node __free(device_node) = NULL;
cpu_node = of_cpu_device_node_get(cpu);
if (!cpu_node)
@@ -399,8 +400,6 @@ static int spm_get_cpu(struct device *dev)
saw_node = of_parse_phandle(cpu_node, "qcom,saw", 0);
found = (saw_node == dev->of_node);
- of_node_put(saw_node);
- of_node_put(cpu_node);
if (found)
return cpu;
--
2.34.1