linux-kernel.vger.kernel.org archive mirror
 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 related	[flat|nested] 10+ messages in thread

* Re: [PATCH] ASoC: simple-card: Fix refcount underflow
  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 18:49 ` Applied "ASoC: simple-card: Fix refcount underflow" to the asoc tree Mark Brown
  2019-02-18 18:52 ` Mark Brown
  2 siblings, 1 reply; 10+ messages in thread
From: Kuninori Morimoto @ 2019-02-18  1:17 UTC (permalink / raw)
  To: Daniel Baluta
  Cc: broonie, vicencb, alsa-devel, tiwai, lgirdwood, gregkh,
	linux-kernel, dl-linux-imx, S.j. Wang


Hi Daniel, Mark

> 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>
> ---

I'm not sure which one is correct in this case

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

or

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.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

* Re: [PATCH] ASoC: simple-card: Fix refcount underflow
  2019-02-18  1:17 ` Kuninori Morimoto
@ 2019-02-18  1:37   ` Kuninori Morimoto
  2019-02-18  7:06     ` Daniel Baluta
  0 siblings, 1 reply; 10+ messages in thread
From: Kuninori Morimoto @ 2019-02-18  1:37 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Daniel Baluta, broonie, vicencb, alsa-devel, tiwai, lgirdwood,
	gregkh, linux-kernel, dl-linux-imx, S.j. Wang


Hi Daniel, Mark, again

> > 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>
> > ---
> 
> I'm not sure which one is correct in this case
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> or
> 
> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

And we want to add

Fixes: commit da215354eb55c ("ASoC: simple-card: merge simple-scu-card")


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

* Re: [PATCH] ASoC: simple-card: Fix refcount underflow
  2019-02-18  1:37   ` Kuninori Morimoto
@ 2019-02-18  7:06     ` Daniel Baluta
  2019-02-18  7:52       ` Takashi Iwai
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Baluta @ 2019-02-18  7:06 UTC (permalink / raw)
  To: kuninori.morimoto.gx
  Cc: dl-linux-imx, linux-kernel, vicencb, broonie, tiwai, lgirdwood,
	gregkh, S.j. Wang, alsa-devel

On Mon, 2019-02-18 at 10:37 +0900, Kuninori Morimoto wrote:
> Hi Daniel, Mark, again
> 
> > > 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://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.kernel.org%2Fpatch%2F10814255%2F&amp;data=02%7C01%7Cdaniel.baluta%40nxp.com%7Ced1b7adc66a546c1bb4608d69541aaf8%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636860506617983174&amp;sdata=hTsurDLdtLAtTw0a5v%2FrSsleSawAP2yiVPl87%2BHCzTI%3D&amp;reserved=0
> > > 
> > > Reported-by: Vicente Bergas <vicencb@gmail.com>
> > > Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> > > ---
> > 
> > I'm not sure which one is correct in this case
> > 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > or
> > 
> > Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> And we want to add
> 
> Fixes: commit da215354eb55c ("ASoC: simple-card: merge simple-scu-
> card")
> 

Thanks! I thought about adding this but the current patch will not
cleanly apply because of:

2d01a84605a55c ("ASoC: simple-card: reduce naming prefix")




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

* Re: [PATCH] ASoC: simple-card: Fix refcount underflow
  2019-02-18  7:06     ` Daniel Baluta
@ 2019-02-18  7:52       ` Takashi Iwai
  2019-02-18 17:50         ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Takashi Iwai @ 2019-02-18  7:52 UTC (permalink / raw)
  To: Daniel Baluta
  Cc: kuninori.morimoto.gx, alsa-devel, lgirdwood, vicencb, broonie,
	gregkh, dl-linux-imx, S.j. Wang, linux-kernel

On Mon, 18 Feb 2019 08:06:19 +0100,
Daniel Baluta wrote:
> 
> On Mon, 2019-02-18 at 10:37 +0900, Kuninori Morimoto wrote:
> > Hi Daniel, Mark, again
> > 
> > > > 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://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.kernel.org%2Fpatch%2F10814255%2F&amp;data=02%7C01%7Cdaniel.baluta%40nxp.com%7Ced1b7adc66a546c1bb4608d69541aaf8%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636860506617983174&amp;sdata=hTsurDLdtLAtTw0a5v%2FrSsleSawAP2yiVPl87%2BHCzTI%3D&amp;reserved=0
> > > > 
> > > > Reported-by: Vicente Bergas <vicencb@gmail.com>
> > > > Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
> > > > ---
> > > 
> > > I'm not sure which one is correct in this case
> > > 
> > > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > > 
> > > or
> > > 
> > > Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > And we want to add
> > 
> > Fixes: commit da215354eb55c ("ASoC: simple-card: merge simple-scu-
> > card")
> > 
> 
> Thanks! I thought about adding this but the current patch will not
> cleanly apply because of:
> 
> 2d01a84605a55c ("ASoC: simple-card: reduce naming prefix")

Yeah, it's a bit tricky because of the code change at this time.

At best, send two patches, once for 5.0 and once for 5.1, and let Mark
apply both of them and do the empty merge from 5.0 to 5.1, or let him
resolve the merge conflict by applying manually the 5.1 patch.


thanks,

Takashi

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

* Re: [PATCH] ASoC: simple-card: Fix refcount underflow
  2019-02-18  7:52       ` Takashi Iwai
@ 2019-02-18 17:50         ` Mark Brown
  2019-02-18 18:00           ` [alsa-devel] " Daniel Baluta
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2019-02-18 17:50 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Daniel Baluta, kuninori.morimoto.gx, alsa-devel, lgirdwood,
	vicencb, gregkh, dl-linux-imx, S.j. Wang, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 970 bytes --]

On Mon, Feb 18, 2019 at 08:52:26AM +0100, Takashi Iwai wrote:
> Daniel Baluta wrote:

> > > Fixes: commit da215354eb55c ("ASoC: simple-card: merge simple-scu-
> > > card")

> > Thanks! I thought about adding this but the current patch will not
> > cleanly apply because of:

> > 2d01a84605a55c ("ASoC: simple-card: reduce naming prefix")

That doesn't matter for fixes tags.  However...

> Yeah, it's a bit tricky because of the code change at this time.

> At best, send two patches, once for 5.0 and once for 5.1, and let Mark
> apply both of them and do the empty merge from 5.0 to 5.1, or let him
> resolve the merge conflict by applying manually the 5.1 patch.

...since this is something that needs to be fixed for v5.0 we need a
patch that can be applied on v5.0 (and has been tested by someone who
sees the issue there).  Takashi's plan seems like a good way to do that,
if you could send a patch against my for-5.0 branch (or just Linus'
tree) that'd be great.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [alsa-devel] [PATCH] ASoC: simple-card: Fix refcount underflow
  2019-02-18 17:50         ` Mark Brown
@ 2019-02-18 18:00           ` Daniel Baluta
  2019-02-18 18:22             ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Baluta @ 2019-02-18 18:00 UTC (permalink / raw)
  To: Mark Brown
  Cc: Takashi Iwai, alsa-devel, kuninori.morimoto.gx, gregkh,
	S.j. Wang, lgirdwood, vicencb, linux-kernel, dl-linux-imx,
	Daniel Baluta

On Mon, Feb 18, 2019 at 7:50 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Mon, Feb 18, 2019 at 08:52:26AM +0100, Takashi Iwai wrote:
> > Daniel Baluta wrote:
>
> > > > Fixes: commit da215354eb55c ("ASoC: simple-card: merge simple-scu-
> > > > card")
>
> > > Thanks! I thought about adding this but the current patch will not
> > > cleanly apply because of:
>
> > > 2d01a84605a55c ("ASoC: simple-card: reduce naming prefix")
>
> That doesn't matter for fixes tags.  However...
>
> > Yeah, it's a bit tricky because of the code change at this time.
>
> > At best, send two patches, once for 5.0 and once for 5.1, and let Mark
> > apply both of them and do the empty merge from 5.0 to 5.1, or let him
> > resolve the merge conflict by applying manually the 5.1 patch.
>
> ...since this is something that needs to be fixed for v5.0 we need a
> patch that can be applied on v5.0 (and has been tested by someone who
> sees the issue there).  Takashi's plan seems like a good way to do that,
> if you could send a patch against my for-5.0 branch (or just Linus'
> tree) that'd be great.

for-5.0 branch Kuninori's patch works fine:

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

for-5.1 branch and later my patch works fine:

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

Would you want me to change the patch for 5.0 to have an identical commit
message as the one for 5.1?

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

* Re: [alsa-devel] [PATCH] ASoC: simple-card: Fix refcount underflow
  2019-02-18 18:00           ` [alsa-devel] " Daniel Baluta
@ 2019-02-18 18:22             ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2019-02-18 18:22 UTC (permalink / raw)
  To: Daniel Baluta
  Cc: Takashi Iwai, alsa-devel, kuninori.morimoto.gx, gregkh,
	S.j. Wang, lgirdwood, vicencb, linux-kernel, dl-linux-imx,
	Daniel Baluta

[-- Attachment #1: Type: text/plain, Size: 252 bytes --]

On Mon, Feb 18, 2019 at 08:00:48PM +0200, Daniel Baluta wrote:

> Would you want me to change the patch for 5.0 to have an identical commit
> message as the one for 5.1?

No, that's fine - since Morimoto-san's patch has been tested I'll just use
that.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Applied "ASoC: simple-card: Fix refcount underflow" to the asoc tree
  2019-02-16 10:09 [PATCH] ASoC: simple-card: Fix refcount underflow Daniel Baluta
  2019-02-18  1:17 ` Kuninori Morimoto
@ 2019-02-18 18:49 ` Mark Brown
  2019-02-18 18:52 ` Mark Brown
  2 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2019-02-18 18:49 UTC (permalink / raw)
  To: Daniel Baluta
  Cc: Vicente Bergas, Mark Brown, kuninori.morimoto.gx, broonie,
	vicencb, alsa-devel, lgirdwood, gregkh, S.j. Wang, tiwai,
	linux-kernel, dl-linux-imx, alsa-devel

The patch

   ASoC: simple-card: Fix refcount underflow

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From 461d854c0dba3cdf63cce37ffb9423eca0793a47 Mon Sep 17 00:00:00 2001
From: Daniel Baluta <daniel.baluta@nxp.com>
Date: Sat, 16 Feb 2019 10:09:42 +0000
Subject: [PATCH] ASoC: simple-card: Fix refcount underflow

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>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 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.20.1


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

* Applied "ASoC: simple-card: Fix refcount underflow" to the asoc tree
  2019-02-16 10:09 [PATCH] ASoC: simple-card: Fix refcount underflow Daniel Baluta
  2019-02-18  1:17 ` Kuninori Morimoto
  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
  2 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2019-02-18 18:52 UTC (permalink / raw)
  To: Daniel Baluta
  Cc: Vicente Bergas, Mark Brown, kuninori.morimoto.gx, broonie,
	vicencb, alsa-devel, lgirdwood, gregkh, S.j. Wang, tiwai,
	linux-kernel, dl-linux-imx, alsa-devel

The patch

   ASoC: simple-card: Fix refcount underflow

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From 461d854c0dba3cdf63cce37ffb9423eca0793a47 Mon Sep 17 00:00:00 2001
From: Daniel Baluta <daniel.baluta@nxp.com>
Date: Sat, 16 Feb 2019 10:09:42 +0000
Subject: [PATCH] ASoC: simple-card: Fix refcount underflow

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>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 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.20.1


^ permalink raw reply related	[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;
as well as URLs for NNTP newsgroup(s).