mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
To: Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kathiravan Thirumoorthy
	<kathiravan.thirumoorthy@oss.qualcomm.com>
Subject: [PATCH 08/10] soc: qcom: smsm: Use __cleanup() for device_node pointers
Date: Mon, 17 Nov 2025 10:21:27 +0530	[thread overview]
Message-ID: <20251117-cleanup_node_put-v1-8-5f107071d171@oss.qualcomm.com> (raw)
In-Reply-To: <20251117-cleanup_node_put-v1-0-5f107071d171@oss.qualcomm.com>

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@oss.qualcomm.com>
---
 drivers/soc/qcom/smsm.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c
index 021e9d1f61dc5200514c5a239d52be97f7e82825..5600712f9185bba8c82da431cfb9f21f1bc44761 100644
--- a/drivers/soc/qcom/smsm.c
+++ b/drivers/soc/qcom/smsm.c
@@ -397,7 +397,7 @@ static int smsm_parse_mbox(struct qcom_smsm *smsm, unsigned int host_id)
  */
 static int smsm_parse_ipc(struct qcom_smsm *smsm, unsigned host_id)
 {
-	struct device_node *syscon;
+	struct device_node *syscon __free(device_node) = NULL;
 	struct device_node *node = smsm->dev->of_node;
 	struct smsm_host *host = &smsm->hosts[host_id];
 	char key[16];
@@ -409,7 +409,6 @@ static int smsm_parse_ipc(struct qcom_smsm *smsm, unsigned host_id)
 		return 0;
 
 	host->ipc_regmap = syscon_node_to_regmap(syscon);
-	of_node_put(syscon);
 	if (IS_ERR(host->ipc_regmap))
 		return PTR_ERR(host->ipc_regmap);
 
@@ -509,8 +508,8 @@ static int smsm_get_size_info(struct qcom_smsm *smsm)
 
 static int qcom_smsm_probe(struct platform_device *pdev)
 {
-	struct device_node *local_node;
-	struct device_node *node;
+	struct device_node *local_node __free(device_node) = NULL;
+	struct device_node *node __free(device_node) = NULL;
 	struct smsm_entry *entry;
 	struct qcom_smsm *smsm;
 	u32 *intr_mask;
@@ -640,12 +639,10 @@ static int qcom_smsm_probe(struct platform_device *pdev)
 	}
 
 	platform_set_drvdata(pdev, smsm);
-	of_node_put(local_node);
 
 	return 0;
 
 unwind_interfaces:
-	of_node_put(node);
 	for (id = 0; id < smsm->num_entries; id++)
 		if (smsm->entries[id].domain)
 			irq_domain_remove(smsm->entries[id].domain);
@@ -655,7 +652,6 @@ static int qcom_smsm_probe(struct platform_device *pdev)
 	for (id = 0; id < smsm->num_hosts; id++)
 		mbox_free_channel(smsm->hosts[id].mbox_chan);
 
-	of_node_put(local_node);
 	return ret;
 }
 

-- 
2.34.1


  parent reply	other threads:[~2025-11-17  4:51 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17  4:51 [PATCH 00/10] soc: qcom: " Kathiravan Thirumoorthy
2025-11-17  4:51 ` [PATCH 01/10] soc: qcom: aoss: " Kathiravan Thirumoorthy
2025-11-17 11:35   ` Konrad Dybcio
2025-11-18 11:39     ` Krzysztof Kozlowski
2025-11-18 12:25       ` Dmitry Baryshkov
2025-11-18 12:32         ` Krzysztof Kozlowski
2025-11-18 12:52           ` Dmitry Baryshkov
2025-11-18 13:16             ` Konrad Dybcio
2025-11-18 13:25               ` Krzysztof Kozlowski
2025-11-18 15:18           ` Kathiravan Thirumoorthy
2025-11-18 11:38   ` Krzysztof Kozlowski
2025-11-17  4:51 ` [PATCH 02/10] soc: qcom: gsbi: " Kathiravan Thirumoorthy
2025-11-17 11:35   ` Konrad Dybcio
2025-11-18 11:38   ` Krzysztof Kozlowski
2025-11-17  4:51 ` [PATCH 03/10] soc: qcom: pd-mapper: " Kathiravan Thirumoorthy
2025-11-17 11:36   ` Konrad Dybcio
2025-11-18 11:43   ` Krzysztof Kozlowski
2025-11-17  4:51 ` [PATCH 04/10] soc: qcom: rpm-proc: " Kathiravan Thirumoorthy
2025-11-17 11:36   ` Konrad Dybcio
2025-11-18 11:40   ` Krzysztof Kozlowski
2025-11-17  4:51 ` [PATCH 05/10] soc: qcom: rpm_master_stats: " Kathiravan Thirumoorthy
2025-11-17 11:37   ` Konrad Dybcio
2025-11-18 11:40   ` Krzysztof Kozlowski
2025-11-17  4:51 ` [PATCH 06/10] soc: qcom: smem: " Kathiravan Thirumoorthy
2025-11-17 11:37   ` Konrad Dybcio
2025-11-18 11:42   ` Krzysztof Kozlowski
2025-11-17  4:51 ` [PATCH 07/10] soc: qcom: smp2p: " Kathiravan Thirumoorthy
2025-11-17 11:37   ` Konrad Dybcio
2025-11-18 11:41   ` Krzysztof Kozlowski
2025-11-17  4:51 ` Kathiravan Thirumoorthy [this message]
2025-11-17 11:38   ` [PATCH 08/10] soc: qcom: smsm: " Konrad Dybcio
2025-11-18 11:42   ` Krzysztof Kozlowski
2025-11-17  4:51 ` [PATCH 09/10] soc: qcom: spm: " Kathiravan Thirumoorthy
2025-11-17 11:38   ` Konrad Dybcio
2025-11-18 11:42   ` Krzysztof Kozlowski
2025-11-17  4:51 ` [PATCH 10/10] soc: qcom: ubwc: " Kathiravan Thirumoorthy
2025-11-17 11:39   ` Konrad Dybcio
2025-11-18 11:43   ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251117-cleanup_node_put-v1-8-5f107071d171@oss.qualcomm.com \
    --to=kathiravan.thirumoorthy@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®