diff mbox series

ASoC: rsnd: Add of_node_put() before return

Message ID 20211015032305.3771-1-wanjiabing@vivo.com (mailing list archive)
State Accepted
Commit 173632358fde7a567f28e07c4549b959ee857986
Headers show
Series ASoC: rsnd: Add of_node_put() before return | expand

Commit Message

Jiabing Wan Oct. 15, 2021, 3:22 a.m. UTC
Fix following coccicheck warning:
./sound/soc/sh/rcar/core.c:1223:1-23: WARNING: Function
for_each_child_of_node should have of_node_put() before return

Early exits from for_each_child_of_node should decrement the
node reference counter.

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
 sound/soc/sh/rcar/core.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 978bd0406729..6a8fe0da7670 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -1225,6 +1225,7 @@  int rsnd_node_count(struct rsnd_priv *priv, struct device_node *node, char *name
 		if (i < 0) {
 			dev_err(dev, "strange node numbering (%s)",
 				of_node_full_name(node));
+			of_node_put(np);
 			return 0;
 		}
 		i++;