diff mbox series

sound: rk817 reduce memmory leak chance with __free

Message ID 20240430055918.131299-1-david.hunter.linux@gmail.com (mailing list archive)
State New, archived
Headers show
Series sound: rk817 reduce memmory leak chance with __free | expand

Commit Message

David Hunter April 30, 2024, 5:59 a.m. UTC
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 mbox series

Patch

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)