mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: simple-card: Fix refcount underflow
@ 2019-02-16 10:09 Daniel Baluta
  2019-02-18  1:17 ` Kuninori Morimoto
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Daniel Baluta @ 2019-02-16 10:09 UTC (permalink / raw)
  To: kuninori.morimoto.gx, broonie, vicencb
  Cc: alsa-devel, tiwai, lgirdwood, gregkh, linux-kernel, dl-linux-imx,
	S.j. Wang, Daniel Baluta

of_get_child_by_name() takes a reference we'll need to drop
later so when we substitute in top we need to take a reference
as well as just assigning.

Without this patch we hit the following error:

[    1.246852] OF: ERROR: Bad of_node_put() on /sound-wm8524
[    1.262261] Hardware name: NXP i.MX8MQ EVK (DT)
[    1.266807] Workqueue: events deferred_probe_work_func
[    1.271950] Call trace:
[    1.274406]  dump_backtrace+0x0/0x158
[    1.278074]  show_stack+0x14/0x20
[    1.281396]  dump_stack+0xa8/0xcc
[    1.284717]  of_node_release+0xb0/0xc8
[    1.288474]  kobject_put+0x74/0xf0
[    1.291879]  of_node_put+0x14/0x28
[    1.295286]  __of_get_next_child+0x44/0x70
[    1.299387]  of_get_next_child+0x3c/0x60
[    1.303315]  simple_for_each_link+0x1dc/0x230
[    1.307676]  simple_probe+0x80/0x540
[    1.311256]  platform_drv_probe+0x50/0xa0

This patch is based on an earlier version posted by Kuninori Morimoto
and commit message includes explanations from Mark Brown.

https://patchwork.kernel.org/patch/10814255/

Reported-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
 sound/soc/generic/simple-card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 08df261024cf..dc18c4492955 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -445,7 +445,7 @@ static int simple_for_each_link(struct simple_priv *priv,
 	/* Check if it has dai-link */
 	node = of_get_child_by_name(top, PREFIX "dai-link");
 	if (!node) {
-		node = top;
+		node = of_node_get(top);
 		is_top = 1;
 	}
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-02-18 18:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-16 10:09 [PATCH] ASoC: simple-card: Fix refcount underflow Daniel Baluta
2019-02-18  1:17 ` Kuninori Morimoto
2019-02-18  1:37   ` Kuninori Morimoto
2019-02-18  7:06     ` Daniel Baluta
2019-02-18  7:52       ` Takashi Iwai
2019-02-18 17:50         ` Mark Brown
2019-02-18 18:00           ` [alsa-devel] " Daniel Baluta
2019-02-18 18:22             ` Mark Brown
2019-02-18 18:49 ` Applied "ASoC: simple-card: Fix refcount underflow" to the asoc tree Mark Brown
2019-02-18 18:52 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®