[alsa-devel] [PATCH] ASoC: audio-graph-scu-card: fix balance of of_node_get/put()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Wed Jul 26 04:51:33 CEST 2017


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

audio-graph-scu-card with CONFIG_OF_DYNAMIC triggers several
errors at kernel boot, like the following one
OF: ERROR: Bad of_node_put() on /soc/sound at ec500000/ports/port at 1

This patch doesn't call unnecessary of_node_put() which was
called in other function (= of_graph_get_port_parent(),
of_phandle_iterator_next())

Reported-by: Antonio Borneo <borneo.antonio at gmail.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 sound/soc/generic/audio-graph-scu-card.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/sound/soc/generic/audio-graph-scu-card.c b/sound/soc/generic/audio-graph-scu-card.c
index dcd2df3..bff1e6a 100644
--- a/sound/soc/generic/audio-graph-scu-card.c
+++ b/sound/soc/generic/audio-graph-scu-card.c
@@ -215,7 +215,6 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
 		codec_ep = of_graph_get_remote_endpoint(cpu_ep);
 		rcpu_ep  = of_graph_get_remote_endpoint(codec_ep);
 
-		of_node_put(cpu_port);
 		of_node_put(cpu_ep);
 		of_node_put(codec_ep);
 		of_node_put(rcpu_ep);
@@ -248,11 +247,9 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
 			cpu_port = it.node;
 			cpu_ep   = of_get_next_child(cpu_port, NULL);
 			codec_ep = of_graph_get_remote_endpoint(cpu_ep);
-			codec_port = of_graph_get_port_parent(codec_ep);
+			codec_port = of_graph_get_port_parent(codec_ep); /* call put */
 
-			of_node_put(cpu_port);
 			of_node_put(cpu_ep);
-			of_node_put(codec_ep);
 			of_node_put(codec_port);
 
 			if (codec) {
@@ -304,11 +301,9 @@ static int asoc_graph_get_dais_count(struct device *dev)
 		cpu_port = it.node;
 		cpu_ep   = of_get_next_child(cpu_port, NULL);
 		codec_ep = of_graph_get_remote_endpoint(cpu_ep);
-		codec_port = of_graph_get_port_parent(codec_ep);
+		codec_port = of_graph_get_port_parent(codec_ep); /* call put */
 
-		of_node_put(cpu_port);
 		of_node_put(cpu_ep);
-		of_node_put(codec_ep);
 		of_node_put(codec_port);
 
 		if (cpu_ep)
-- 
1.9.1



More information about the Alsa-devel mailing list