[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251117-scm_cleanup_of_node_put-v1-1-307d36d6b849@oss.qualcomm.com>
Date: Mon, 17 Nov 2025 21:52:55 +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] firmware: qcom: scm: Use __cleanup() for device_node
pointers
Make use of the __cleanup() attribute for device_node pointers to simplify
resource management and remove explicit of_node_put() calls.
Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@....qualcomm.com>
---
drivers/firmware/qcom/qcom_scm.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
index e777b7cb9b127944fe112f453cae9cbc40c06cae..7c1fffa8e7ad48b294b90e7e63f726d0ba7d55e1 100644
--- a/drivers/firmware/qcom/qcom_scm.c
+++ b/drivers/firmware/qcom/qcom_scm.c
@@ -1746,7 +1746,7 @@ EXPORT_SYMBOL_GPL(qcom_scm_gpu_init_regs);
static int qcom_scm_find_dload_address(struct device *dev, u64 *addr)
{
- struct device_node *tcsr;
+ struct device_node *tcsr __free(device_node) = NULL;
struct device_node *np = dev->of_node;
struct resource res;
u32 offset;
@@ -1757,7 +1757,6 @@ static int qcom_scm_find_dload_address(struct device *dev, u64 *addr)
return 0;
ret = of_address_to_resource(tcsr, 0, &res);
- of_node_put(tcsr);
if (ret)
return ret;
@@ -2020,17 +2019,12 @@ static const struct of_device_id qcom_scm_qseecom_allowlist[] __maybe_unused = {
static bool qcom_scm_qseecom_machine_is_allowed(void)
{
- struct device_node *np;
- bool match;
+ struct device_node *np __free(device_node) = of_find_node_by_path("/");
- np = of_find_node_by_path("/");
if (!np)
return false;
- match = of_match_node(qcom_scm_qseecom_allowlist, np);
- of_node_put(np);
-
- return match;
+ return of_match_node(qcom_scm_qseecom_allowlist, np);
}
static void qcom_scm_qseecom_free(void *data)
---
base-commit: 0c1c7a6a83feaf2cf182c52983ffe330ffb50280
change-id: 20251117-scm_cleanup_of_node_put-6c915216b1bf
Best regards,
--
Kathiravan Thirumoorthy <kathiravan.thirumoorthy@....qualcomm.com>
Powered by blists - more mailing lists