[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251117-cleanup_node_put-v1-9-5f107071d171@oss.qualcomm.com>
Date: Mon, 17 Nov 2025 10:21:28 +0530
From: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@....qualcomm.com>
To: Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>
Cc: linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
Kathiravan Thirumoorthy <kathiravan.thirumoorthy@....qualcomm.com>
Subject: [PATCH 09/10] soc: qcom: spm: Use __cleanup() for device_node
pointers
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@....qualcomm.com>
---
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
Powered by blists - more mailing lists