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@xxxxxxxxx>
---
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
[Index of Archives]
[Pulseaudio]
[Linux Audio Users]
[ALSA Devel]
[Fedora Desktop]
[Fedora SELinux]
[Big List of Linux Books]
[Yosemite News]
[KDE Users]