All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: wm9713: fix regmap free path
@ 2016-02-22 22:35 Robert Jarzmik
  2016-02-23 14:00   ` Charles Keepax
  2016-02-24  3:53 ` Applied "ASoC: wm9713: fix regmap free path" to the asoc tree Mark Brown
  0 siblings, 2 replies; 8+ messages in thread
From: Robert Jarzmik @ 2016-02-22 22:35 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: patches, alsa-devel, linux-kernel, Robert Jarzmik, Lars-Peter Clausen

In the conversion to regmap, I assumed that the devm_() variant could be
used in the soc probe function.

As a mater of fact with the current code the regmap is freed twice
because of the devm_() call:
(mutex_lock) from [<c01f6624>] (debugfs_remove_recursive+0x50/0x1d0)
(debugfs_remove_recursive) from [<c02bf800>] (regmap_debugfs_exit+0x1c/0xd4)
(regmap_debugfs_exit) from [<c02ba1f8>] (regmap_exit+0x28/0xc8)
(regmap_exit) from [<c02aa258>] (release_nodes+0x18c/0x204)
(release_nodes) from [<c02a278c>] (device_release+0x18/0x90)
(device_release) from [<c0239030>] (kobject_release+0x90/0x1bc)
(kobject_release) from [<c0395c94>] (wm9713_soc_remove+0x1c/0x24)
(wm9713_soc_remove) from [<c0384884>] (soc_remove_component+0x50/0x7c)
(soc_remove_component) from [<c0386c28>] (soc_remove_dai_links+0x118/0x228)
(soc_remove_dai_links) from [<c038721c>] (snd_soc_register_card+0x4e4/0xdd4)
(snd_soc_register_card) from [<c0393c54>] (devm_snd_soc_register_card+0x34/0x70)

Fix this by replacing the devm_regmap initialization code with the non
devm_() variant.

Fixes: 700dadfefc3d ASoC: wm9713: convert to regmap
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
Since v1: changed the fix into removing the devm_() variant
---
 sound/soc/codecs/wm9713.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index 4e522302bb8a..edd270f6d8e5 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -1212,7 +1212,7 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec)
 	if (IS_ERR(wm9713->ac97))
 		return PTR_ERR(wm9713->ac97);
 
-	regmap = devm_regmap_init_ac97(wm9713->ac97, &wm9713_regmap_config);
+	regmap = regmap_init_ac97(wm9713->ac97, &wm9713_regmap_config);
 	if (IS_ERR(regmap)) {
 		snd_soc_free_ac97_codec(wm9713->ac97);
 		return PTR_ERR(regmap);
-- 
2.1.4

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

* Re: [PATCH v2] ASoC: wm9713: fix regmap free path
  2016-02-22 22:35 [PATCH v2] ASoC: wm9713: fix regmap free path Robert Jarzmik
@ 2016-02-23 14:00   ` Charles Keepax
  2016-02-24  3:53 ` Applied "ASoC: wm9713: fix regmap free path" to the asoc tree Mark Brown
  1 sibling, 0 replies; 8+ messages in thread
From: Charles Keepax @ 2016-02-23 14:00 UTC (permalink / raw)
  To: Robert Jarzmik
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	patches, alsa-devel, linux-kernel, Lars-Peter Clausen

On Mon, Feb 22, 2016 at 11:35:44PM +0100, Robert Jarzmik wrote:
> In the conversion to regmap, I assumed that the devm_() variant could be
> used in the soc probe function.
> 
> As a mater of fact with the current code the regmap is freed twice
> because of the devm_() call:
> (mutex_lock) from [<c01f6624>] (debugfs_remove_recursive+0x50/0x1d0)
> (debugfs_remove_recursive) from [<c02bf800>] (regmap_debugfs_exit+0x1c/0xd4)
> (regmap_debugfs_exit) from [<c02ba1f8>] (regmap_exit+0x28/0xc8)
> (regmap_exit) from [<c02aa258>] (release_nodes+0x18c/0x204)
> (release_nodes) from [<c02a278c>] (device_release+0x18/0x90)
> (device_release) from [<c0239030>] (kobject_release+0x90/0x1bc)
> (kobject_release) from [<c0395c94>] (wm9713_soc_remove+0x1c/0x24)
> (wm9713_soc_remove) from [<c0384884>] (soc_remove_component+0x50/0x7c)
> (soc_remove_component) from [<c0386c28>] (soc_remove_dai_links+0x118/0x228)
> (soc_remove_dai_links) from [<c038721c>] (snd_soc_register_card+0x4e4/0xdd4)
> (snd_soc_register_card) from [<c0393c54>] (devm_snd_soc_register_card+0x34/0x70)
> 
> Fix this by replacing the devm_regmap initialization code with the non
> devm_() variant.
> 
> Fixes: 700dadfefc3d ASoC: wm9713: convert to regmap
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

I am totally happy for this patch to be merged but would it not
be prefferable to do the regmap init in the device probe and
still use the devm_ call?  Doing the regmap setup in the ASoC
probe is a little unusual and I don't really see any reason why
it is necessary here. Unless I am missing something?

Thanks,
Charles

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

* Re: [PATCH v2] ASoC: wm9713: fix regmap free path
@ 2016-02-23 14:00   ` Charles Keepax
  0 siblings, 0 replies; 8+ messages in thread
From: Charles Keepax @ 2016-02-23 14:00 UTC (permalink / raw)
  To: Robert Jarzmik
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	patches, alsa-devel, linux-kernel, Lars-Peter Clausen

On Mon, Feb 22, 2016 at 11:35:44PM +0100, Robert Jarzmik wrote:
> In the conversion to regmap, I assumed that the devm_() variant could be
> used in the soc probe function.
> 
> As a mater of fact with the current code the regmap is freed twice
> because of the devm_() call:
> (mutex_lock) from [<c01f6624>] (debugfs_remove_recursive+0x50/0x1d0)
> (debugfs_remove_recursive) from [<c02bf800>] (regmap_debugfs_exit+0x1c/0xd4)
> (regmap_debugfs_exit) from [<c02ba1f8>] (regmap_exit+0x28/0xc8)
> (regmap_exit) from [<c02aa258>] (release_nodes+0x18c/0x204)
> (release_nodes) from [<c02a278c>] (device_release+0x18/0x90)
> (device_release) from [<c0239030>] (kobject_release+0x90/0x1bc)
> (kobject_release) from [<c0395c94>] (wm9713_soc_remove+0x1c/0x24)
> (wm9713_soc_remove) from [<c0384884>] (soc_remove_component+0x50/0x7c)
> (soc_remove_component) from [<c0386c28>] (soc_remove_dai_links+0x118/0x228)
> (soc_remove_dai_links) from [<c038721c>] (snd_soc_register_card+0x4e4/0xdd4)
> (snd_soc_register_card) from [<c0393c54>] (devm_snd_soc_register_card+0x34/0x70)
> 
> Fix this by replacing the devm_regmap initialization code with the non
> devm_() variant.
> 
> Fixes: 700dadfefc3d ASoC: wm9713: convert to regmap
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

I am totally happy for this patch to be merged but would it not
be prefferable to do the regmap init in the device probe and
still use the devm_ call?  Doing the regmap setup in the ASoC
probe is a little unusual and I don't really see any reason why
it is necessary here. Unless I am missing something?

Thanks,
Charles

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

* Re: [PATCH v2] ASoC: wm9713: fix regmap free path
  2016-02-23 14:00   ` Charles Keepax
  (?)
@ 2016-02-23 14:04   ` Lars-Peter Clausen
  -1 siblings, 0 replies; 8+ messages in thread
From: Lars-Peter Clausen @ 2016-02-23 14:04 UTC (permalink / raw)
  To: Charles Keepax, Robert Jarzmik
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	patches, alsa-devel, linux-kernel

On 02/23/2016 03:00 PM, Charles Keepax wrote:
> On Mon, Feb 22, 2016 at 11:35:44PM +0100, Robert Jarzmik wrote:
>> In the conversion to regmap, I assumed that the devm_() variant could be
>> used in the soc probe function.
>>
>> As a mater of fact with the current code the regmap is freed twice
>> because of the devm_() call:
>> (mutex_lock) from [<c01f6624>] (debugfs_remove_recursive+0x50/0x1d0)
>> (debugfs_remove_recursive) from [<c02bf800>] (regmap_debugfs_exit+0x1c/0xd4)
>> (regmap_debugfs_exit) from [<c02ba1f8>] (regmap_exit+0x28/0xc8)
>> (regmap_exit) from [<c02aa258>] (release_nodes+0x18c/0x204)
>> (release_nodes) from [<c02a278c>] (device_release+0x18/0x90)
>> (device_release) from [<c0239030>] (kobject_release+0x90/0x1bc)
>> (kobject_release) from [<c0395c94>] (wm9713_soc_remove+0x1c/0x24)
>> (wm9713_soc_remove) from [<c0384884>] (soc_remove_component+0x50/0x7c)
>> (soc_remove_component) from [<c0386c28>] (soc_remove_dai_links+0x118/0x228)
>> (soc_remove_dai_links) from [<c038721c>] (snd_soc_register_card+0x4e4/0xdd4)
>> (snd_soc_register_card) from [<c0393c54>] (devm_snd_soc_register_card+0x34/0x70)
>>
>> Fix this by replacing the devm_regmap initialization code with the non
>> devm_() variant.
>>
>> Fixes: 700dadfefc3d ASoC: wm9713: convert to regmap
>> Cc: Lars-Peter Clausen <lars@metafoo.de>
>> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
>> ---
> 
> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> 
> I am totally happy for this patch to be merged but would it not
> be prefferable to do the regmap init in the device probe and
> still use the devm_ call?  Doing the regmap setup in the ASoC
> probe is a little unusual and I don't really see any reason why
> it is necessary here. Unless I am missing something?

It's AC97... there is just no proper device model integration for AC97 at
the moment.

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

* Applied "ASoC: wm9713: fix regmap free path" to the asoc tree
  2016-02-22 22:35 [PATCH v2] ASoC: wm9713: fix regmap free path Robert Jarzmik
  2016-02-23 14:00   ` Charles Keepax
@ 2016-02-24  3:53 ` Mark Brown
  1 sibling, 0 replies; 8+ messages in thread
From: Mark Brown @ 2016-02-24  3:53 UTC (permalink / raw)
  To: Robert Jarzmik, Charles Keepax, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: wm9713: fix regmap free path

has been applied to the asoc tree at

   git://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 da9b9303ed8d1673a89a4bdd85464e33614775e3 Mon Sep 17 00:00:00 2001
From: Robert Jarzmik <robert.jarzmik@free.fr>
Date: Mon, 22 Feb 2016 23:35:44 +0100
Subject: [PATCH] ASoC: wm9713: fix regmap free path

In the conversion to regmap, I assumed that the devm_() variant could be
used in the soc probe function.

As a mater of fact with the current code the regmap is freed twice
because of the devm_() call:
(mutex_lock) from [<c01f6624>] (debugfs_remove_recursive+0x50/0x1d0)
(debugfs_remove_recursive) from [<c02bf800>] (regmap_debugfs_exit+0x1c/0xd4)
(regmap_debugfs_exit) from [<c02ba1f8>] (regmap_exit+0x28/0xc8)
(regmap_exit) from [<c02aa258>] (release_nodes+0x18c/0x204)
(release_nodes) from [<c02a278c>] (device_release+0x18/0x90)
(device_release) from [<c0239030>] (kobject_release+0x90/0x1bc)
(kobject_release) from [<c0395c94>] (wm9713_soc_remove+0x1c/0x24)
(wm9713_soc_remove) from [<c0384884>] (soc_remove_component+0x50/0x7c)
(soc_remove_component) from [<c0386c28>] (soc_remove_dai_links+0x118/0x228)
(soc_remove_dai_links) from [<c038721c>] (snd_soc_register_card+0x4e4/0xdd4)
(snd_soc_register_card) from [<c0393c54>] (devm_snd_soc_register_card+0x34/0x70)

Fix this by replacing the devm_regmap initialization code with the non
devm_() variant.

Fixes: 700dadfefc3d ASoC: wm9713: convert to regmap
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/wm9713.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index 79e143625ac3..9849643ef809 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -1212,7 +1212,7 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec)
 	if (IS_ERR(wm9713->ac97))
 		return PTR_ERR(wm9713->ac97);
 
-	regmap = devm_regmap_init_ac97(wm9713->ac97, &wm9713_regmap_config);
+	regmap = regmap_init_ac97(wm9713->ac97, &wm9713_regmap_config);
 	if (IS_ERR(regmap)) {
 		snd_soc_free_ac97_codec(wm9713->ac97);
 		return PTR_ERR(regmap);
-- 
2.7.0

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

* Re: [PATCH v2] ASoC: wm9713: fix regmap free path
  2016-02-20 19:44 ` Robert Jarzmik
  (?)
@ 2016-02-21 10:12 ` Lars-Peter Clausen
  -1 siblings, 0 replies; 8+ messages in thread
From: Lars-Peter Clausen @ 2016-02-21 10:12 UTC (permalink / raw)
  To: Robert Jarzmik, Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: alsa-devel, patches, linux-kernel

On 02/20/2016 08:44 PM, Robert Jarzmik wrote:
> In the conversion to regmap, I assumed that the 2 following functions
> was working symetrically:
>  - snd_soc_codec_init_regmap()
>  - snd_soc_codec_exit_regmap(codec)
> 
> As a mater of fact with the current code the regmap is freed twice
> because of the devm_() call:
> (mutex_lock) from (debugfs_remove_recursive+0x50/0x1d0)
> (debugfs_remove_recursive) from (regmap_debugfs_exit+0x1c/0xd4)
> (regmap_debugfs_exit) from (regmap_exit+0x28/0xc8)
> (regmap_exit) from (release_nodes+0x18c/0x204)
> (release_nodes) from (device_release+0x18/0x90)
> (device_release) from (kobject_release+0x90/0x1bc)
> (kobject_release) from (wm9713_soc_remove+0x1c/0x24)
> (wm9713_soc_remove) from (soc_remove_component+0x50/0x7c)
> (soc_remove_component) from (soc_remove_dai_links+0x118/0x228)
> (soc_remove_dai_links) from (snd_soc_register_card+0x4e4/0xdd4)
> (snd_soc_register_card) from (devm_snd_soc_register_card+0x34/0x70)
> 
> Fix this by removing the doubled regmap free.

The correct fix is to use the non devm variant of regmap_init_ac97() in this
case. Device managed functions should only be used from inside a struct
device probe function.

- Lars

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

* [PATCH v2] ASoC: wm9713: fix regmap free path
@ 2016-02-20 19:44 ` Robert Jarzmik
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Jarzmik @ 2016-02-20 19:44 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: patches, alsa-devel, linux-kernel, Robert Jarzmik

In the conversion to regmap, I assumed that the 2 following functions
was working symetrically:
 - snd_soc_codec_init_regmap()
 - snd_soc_codec_exit_regmap(codec)

As a mater of fact with the current code the regmap is freed twice
because of the devm_() call:
(mutex_lock) from (debugfs_remove_recursive+0x50/0x1d0)
(debugfs_remove_recursive) from (regmap_debugfs_exit+0x1c/0xd4)
(regmap_debugfs_exit) from (regmap_exit+0x28/0xc8)
(regmap_exit) from (release_nodes+0x18c/0x204)
(release_nodes) from (device_release+0x18/0x90)
(device_release) from (kobject_release+0x90/0x1bc)
(kobject_release) from (wm9713_soc_remove+0x1c/0x24)
(wm9713_soc_remove) from (soc_remove_component+0x50/0x7c)
(soc_remove_component) from (soc_remove_dai_links+0x118/0x228)
(soc_remove_dai_links) from (snd_soc_register_card+0x4e4/0xdd4)
(snd_soc_register_card) from (devm_snd_soc_register_card+0x34/0x70)

Fix this by removing the doubled regmap free.

Fixes: 700dadfefc3d ASoC: wm9713: convert to regmap
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
Since v1: fix the diff second hunk, god knows where it came from.
---
 sound/soc/codecs/wm9713.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index 79e143625ac3..dd31a5207527 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -1230,7 +1230,6 @@ static int wm9713_soc_remove(struct snd_soc_codec *codec)
 {
 	struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec);
 
-	snd_soc_codec_exit_regmap(codec);
 	snd_soc_free_ac97_codec(wm9713->ac97);
 	return 0;
 }
-- 
2.1.4

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

* [PATCH v2] ASoC: wm9713: fix regmap free path
@ 2016-02-20 19:44 ` Robert Jarzmik
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Jarzmik @ 2016-02-20 19:44 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: alsa-devel, patches, Robert Jarzmik, linux-kernel

In the conversion to regmap, I assumed that the 2 following functions
was working symetrically:
 - snd_soc_codec_init_regmap()
 - snd_soc_codec_exit_regmap(codec)

As a mater of fact with the current code the regmap is freed twice
because of the devm_() call:
(mutex_lock) from (debugfs_remove_recursive+0x50/0x1d0)
(debugfs_remove_recursive) from (regmap_debugfs_exit+0x1c/0xd4)
(regmap_debugfs_exit) from (regmap_exit+0x28/0xc8)
(regmap_exit) from (release_nodes+0x18c/0x204)
(release_nodes) from (device_release+0x18/0x90)
(device_release) from (kobject_release+0x90/0x1bc)
(kobject_release) from (wm9713_soc_remove+0x1c/0x24)
(wm9713_soc_remove) from (soc_remove_component+0x50/0x7c)
(soc_remove_component) from (soc_remove_dai_links+0x118/0x228)
(soc_remove_dai_links) from (snd_soc_register_card+0x4e4/0xdd4)
(snd_soc_register_card) from (devm_snd_soc_register_card+0x34/0x70)

Fix this by removing the doubled regmap free.

Fixes: 700dadfefc3d ASoC: wm9713: convert to regmap
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
Since v1: fix the diff second hunk, god knows where it came from.
---
 sound/soc/codecs/wm9713.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index 79e143625ac3..dd31a5207527 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -1230,7 +1230,6 @@ static int wm9713_soc_remove(struct snd_soc_codec *codec)
 {
 	struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec);
 
-	snd_soc_codec_exit_regmap(codec);
 	snd_soc_free_ac97_codec(wm9713->ac97);
 	return 0;
 }
-- 
2.1.4

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

end of thread, other threads:[~2016-02-24  3:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-22 22:35 [PATCH v2] ASoC: wm9713: fix regmap free path Robert Jarzmik
2016-02-23 14:00 ` Charles Keepax
2016-02-23 14:00   ` Charles Keepax
2016-02-23 14:04   ` Lars-Peter Clausen
2016-02-24  3:53 ` Applied "ASoC: wm9713: fix regmap free path" to the asoc tree Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2016-02-20 19:44 [PATCH v2] ASoC: wm9713: fix regmap free path Robert Jarzmik
2016-02-20 19:44 ` Robert Jarzmik
2016-02-21 10:12 ` Lars-Peter Clausen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.