Linux Sound subsystem development
 help / color / mirror / Atom feed
From: David Hunter <david.hunter.linux@gmail.com>
To: linux-sound@vger.kernel.org
Cc: David Hunter <david.hunter.linux@gmail.com>,
	lgirdwood@gmail.com, broonie@kernel.org, julia.lawall@inria.fr,
	skhan@linuxfoundation.org, javier.carrasco.cruz@gmail.com
Subject: [PATCH] sound: rk817 reduce memmory leak chance with __free
Date: Tue, 30 Apr 2024 01:59:18 -0400	[thread overview]
Message-ID: <20240430055918.131299-1-david.hunter.linux@gmail.com> (raw)

Using the __free function instead of of_node_put helps with
preventing memory leaks.

Unable to test.

Signed-off-by: David Hunter <david.hunter.linux@gmail.com>
---
 sound/soc/codecs/rk817_codec.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/rk817_codec.c b/sound/soc/codecs/rk817_codec.c
index d4da98469f8b..bc015dc9c950 100644
--- a/sound/soc/codecs/rk817_codec.c
+++ b/sound/soc/codecs/rk817_codec.c
@@ -456,9 +456,9 @@ static const struct snd_soc_component_driver soc_codec_dev_rk817 = {
 static void rk817_codec_parse_dt_property(struct device *dev,
 					 struct rk817_codec_priv *rk817)
 {
-	struct device_node *node;
+	struct device_node *node __free(device_node) = 
+		of_get_child_by_name(dev->parent->of_node, "codec");
 
-	node = of_get_child_by_name(dev->parent->of_node, "codec");
 	if (!node) {
 		dev_dbg(dev, "%s() Can not get child: codec\n",
 			__func__);
@@ -466,8 +466,6 @@ static void rk817_codec_parse_dt_property(struct device *dev,
 
 	rk817->mic_in_differential =
 			of_property_read_bool(node, "rockchip,mic-in-differential");
-
-	of_node_put(node);
 }
 
 static int rk817_platform_probe(struct platform_device *pdev)
-- 
2.34.1


             reply	other threads:[~2024-04-30  5:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30  5:59 David Hunter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-06-18 13:58 [PATCH] sound:rk817 reduce memmory leak chance with __free David Hunter

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=20240430055918.131299-1-david.hunter.linux@gmail.com \
    --to=david.hunter.linux@gmail.com \
    --cc=broonie@kernel.org \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=julia.lawall@inria.fr \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=skhan@linuxfoundation.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