Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1698359 > unrolled thread

[PATCH v2 3/3] ASoC: simple-card-utils: fix unbalanced of_node_get()/of_node_put()

Started byAntonio Borneo <borneo.antonio@gmail.com>
First post2017-07-28 01:30 +0200
Last post2017-07-28 01:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 3/3] ASoC: simple-card-utils: fix unbalanced of_node_get()/of_node_put() Antonio Borneo <borneo.antonio@gmail.com> - 2017-07-28 01:30 +0200

#1698359 — [PATCH v2 3/3] ASoC: simple-card-utils: fix unbalanced of_node_get()/of_node_put()

FromAntonio Borneo <borneo.antonio@gmail.com>
Date2017-07-28 01:30 +0200
Subject[PATCH v2 3/3] ASoC: simple-card-utils: fix unbalanced of_node_get()/of_node_put()
Message-ID<u80oa-4c2-15@gated-at.bofh.it>
From: Antonio Borneo <borneo.antonio@gmail.com>

On Hikey target board, enabling CONFIG_OF_DYNAMIC triggers several
errors at kernel boot, like the following one
OF: ERROR: Bad of_node_put() on /soc/i2s@f7118000/ports/port@0/endpoint
each followed by stack dump.

of_graph_get_port_parent() walks through the parents looking for a
node named "ports". At each step it uses of_get_next_parent() that
drops the current node with of_node_put().
Avoid dropping the initial node by calling of_node_get() before
of_graph_get_port_parent().

Tested with kernel v4.13-rc2 with hikey_defconfig taken from
https://git.linaro.org/people/john.stultz/android-dev.git
branch dev/hikey-mainline-WIP

This fixes commit 1689333f8311 ("ASoC: simple-card-utils: add
asoc_simple_card_parse_graph_dai()").

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
---
To: Liam Girdwood <lgirdwood@gmail.com>
To: Mark Brown <broonie@kernel.org>
To: Jaroslav Kysela <perex@perex.cz>
To: Takashi Iwai <tiwai@suse.com>
To: alsa-devel@alsa-project.org
Cc: linux-kernel@vger.kernel.org
Cc: Wei Xu <xuwei5@hisilicon.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card-utils.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 26d64fa..144954b 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -250,6 +250,11 @@ static int asoc_simple_card_get_dai_id(struct device_node *ep)
 	if (ret != -ENOTSUPP)
 		return ret;
 
+	/*
+	 * of_graph_get_port_parent() will call
+	 * of_node_put(). So, call of_node_get() here
+	 */
+	of_node_get(ep);
 	node = of_graph_get_port_parent(ep);
 
 	/*
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web