diff mbox

ASoC: audio-graph-scu-card: fix balance of of_node_get/put()

Message ID 87wp6vncg2.wl%kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kuninori Morimoto July 26, 2017, 2:51 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@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@ec500000/ports/port@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@gmail.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/audio-graph-scu-card.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Comments

Kuninori Morimoto July 31, 2017, 12:57 a.m. UTC | #1
Hi

> From: Kuninori Morimoto <kuninori.morimoto.gx@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@ec500000/ports/port@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@gmail.com>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---

Tony Lindgren's patch solved this issue, too
This patch is no longer needed 

Best regards
---
Kuninori Morimoto
diff mbox

Patch

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)