Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH 0/3] ASoC: codecs: wcd93xx: fix OF node leaks on probe failure
@ 2025-12-01  9:34 Johan Hovold
  2025-12-01  9:34 ` [PATCH 1/3] ASoC: codecs: wcd937x: " Johan Hovold
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Johan Hovold @ 2025-12-01  9:34 UTC (permalink / raw)
  To: Srinivas Kandagatla, Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
	linux-arm-msm, linux-kernel, Johan Hovold

The original wcd938x driver has a couple of OF node reference leaks
which have been reproduced in the two later added drivers.

Johan


Johan Hovold (3):
  ASoC: codecs: wcd937x: fix OF node leaks on probe failure
  ASoC: codecs: wcd938x: fix OF node leaks on probe failure
  ASoC: codecs: wcd939x: fix OF node leaks on probe failure

 sound/soc/codecs/wcd937x.c | 4 ++--
 sound/soc/codecs/wcd938x.c | 3 +--
 sound/soc/codecs/wcd939x.c | 3 +--
 3 files changed, 4 insertions(+), 6 deletions(-)

-- 
2.51.2


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

* [PATCH 1/3] ASoC: codecs: wcd937x: fix OF node leaks on probe failure
  2025-12-01  9:34 [PATCH 0/3] ASoC: codecs: wcd93xx: fix OF node leaks on probe failure Johan Hovold
@ 2025-12-01  9:34 ` Johan Hovold
  2025-12-01  9:34 ` [PATCH 2/3] ASoC: codecs: wcd938x: " Johan Hovold
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Johan Hovold @ 2025-12-01  9:34 UTC (permalink / raw)
  To: Srinivas Kandagatla, Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
	linux-arm-msm, linux-kernel, Johan Hovold, Prasad Kumpatla,
	Mohammad Rafi Shaik

The component match entry release function will drop the references
taken while looking up the soundwire OF nodes when the platform device
is unbound.

Drop the additional references taken to avoid leaking them on probe
failure (e.g. probe deferral) and on driver unbind.

Fixes: 9be3ec196da4 ("ASoC: codecs: wcd937x: add wcd937x codec driver")
Cc: Prasad Kumpatla <prasad.kumpatla@oss.qualcomm.com>
Cc: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 sound/soc/codecs/wcd937x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wcd937x.c b/sound/soc/codecs/wcd937x.c
index 421ec7a2d6bd..339d2f097218 100644
--- a/sound/soc/codecs/wcd937x.c
+++ b/sound/soc/codecs/wcd937x.c
@@ -2843,7 +2843,7 @@ static int wcd937x_add_slave_components(struct wcd937x_priv *wcd937x,
 		dev_err(dev, "Couldn't parse phandle to qcom,rx-device!\n");
 		return -ENODEV;
 	}
-	of_node_get(wcd937x->rxnode);
+
 	component_match_add_release(dev, matchptr, component_release_of,
 				    component_compare_of, wcd937x->rxnode);
 
@@ -2852,7 +2852,7 @@ static int wcd937x_add_slave_components(struct wcd937x_priv *wcd937x,
 		dev_err(dev, "Couldn't parse phandle to qcom,tx-device\n");
 			return -ENODEV;
 	}
-	of_node_get(wcd937x->txnode);
+
 	component_match_add_release(dev, matchptr, component_release_of,
 				    component_compare_of, wcd937x->txnode);
 
-- 
2.51.2


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

* [PATCH 2/3] ASoC: codecs: wcd938x: fix OF node leaks on probe failure
  2025-12-01  9:34 [PATCH 0/3] ASoC: codecs: wcd93xx: fix OF node leaks on probe failure Johan Hovold
  2025-12-01  9:34 ` [PATCH 1/3] ASoC: codecs: wcd937x: " Johan Hovold
@ 2025-12-01  9:34 ` Johan Hovold
  2025-12-01  9:34 ` [PATCH 3/3] ASoC: codecs: wcd939x: " Johan Hovold
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Johan Hovold @ 2025-12-01  9:34 UTC (permalink / raw)
  To: Srinivas Kandagatla, Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
	linux-arm-msm, linux-kernel, Johan Hovold, Srinivas Kandagatla

The component match entry release function will drop the references
taken while looking up the soundwire OF nodes when the platform device
is unbound.

Drop the additional references taken to avoid leaking them on probe
failure (e.g. probe deferral) and on driver unbind.

Fixes: 8d78602aa87a ("ASoC: codecs: wcd938x: add basic driver")
Cc: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 sound/soc/codecs/wcd938x.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c
index e1a4783b984c..8357f9f1ad72 100644
--- a/sound/soc/codecs/wcd938x.c
+++ b/sound/soc/codecs/wcd938x.c
@@ -3465,7 +3465,6 @@ static int wcd938x_add_slave_components(struct wcd938x_priv *wcd938x,
 		return -ENODEV;
 	}
 
-	of_node_get(wcd938x->rxnode);
 	component_match_add_release(dev, matchptr, component_release_of,
 				    component_compare_of, wcd938x->rxnode);
 
@@ -3474,7 +3473,7 @@ static int wcd938x_add_slave_components(struct wcd938x_priv *wcd938x,
 		dev_err(dev, "%s: Tx-device node not defined\n", __func__);
 		return -ENODEV;
 	}
-	of_node_get(wcd938x->txnode);
+
 	component_match_add_release(dev, matchptr, component_release_of,
 				    component_compare_of, wcd938x->txnode);
 	return 0;
-- 
2.51.2


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

* [PATCH 3/3] ASoC: codecs: wcd939x: fix OF node leaks on probe failure
  2025-12-01  9:34 [PATCH 0/3] ASoC: codecs: wcd93xx: fix OF node leaks on probe failure Johan Hovold
  2025-12-01  9:34 ` [PATCH 1/3] ASoC: codecs: wcd937x: " Johan Hovold
  2025-12-01  9:34 ` [PATCH 2/3] ASoC: codecs: wcd938x: " Johan Hovold
@ 2025-12-01  9:34 ` Johan Hovold
  2025-12-01 12:18 ` [PATCH 0/3] ASoC: codecs: wcd93xx: " Srinivas Kandagatla
  2025-12-04 13:04 ` Mark Brown
  4 siblings, 0 replies; 6+ messages in thread
From: Johan Hovold @ 2025-12-01  9:34 UTC (permalink / raw)
  To: Srinivas Kandagatla, Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
	linux-arm-msm, linux-kernel, Johan Hovold, Neil Armstrong

The component match entry release function will drop the references
taken while looking up the soundwire OF nodes when the platform device
is unbound.

Drop the additional references taken to avoid leaking them on probe
failure (e.g. probe deferral) and on driver unbind.

Fixes: 10f514bd172a ("ASoC: codecs: Add WCD939x Codec driver")
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 sound/soc/codecs/wcd939x.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wcd939x.c b/sound/soc/codecs/wcd939x.c
index e74e6f013131..4f3be55370e2 100644
--- a/sound/soc/codecs/wcd939x.c
+++ b/sound/soc/codecs/wcd939x.c
@@ -3526,7 +3526,6 @@ static int wcd939x_add_slave_components(struct wcd939x_priv *wcd939x,
 		return -ENODEV;
 	}
 
-	of_node_get(wcd939x->rxnode);
 	component_match_add_release(dev, matchptr, component_release_of,
 				    component_compare_of, wcd939x->rxnode);
 
@@ -3535,7 +3534,7 @@ static int wcd939x_add_slave_components(struct wcd939x_priv *wcd939x,
 		dev_err(dev, "%s: Tx-device node not defined\n", __func__);
 		return -ENODEV;
 	}
-	of_node_get(wcd939x->txnode);
+
 	component_match_add_release(dev, matchptr, component_release_of,
 				    component_compare_of, wcd939x->txnode);
 	return 0;
-- 
2.51.2


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

* Re: [PATCH 0/3] ASoC: codecs: wcd93xx: fix OF node leaks on probe failure
  2025-12-01  9:34 [PATCH 0/3] ASoC: codecs: wcd93xx: fix OF node leaks on probe failure Johan Hovold
                   ` (2 preceding siblings ...)
  2025-12-01  9:34 ` [PATCH 3/3] ASoC: codecs: wcd939x: " Johan Hovold
@ 2025-12-01 12:18 ` Srinivas Kandagatla
  2025-12-04 13:04 ` Mark Brown
  4 siblings, 0 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2025-12-01 12:18 UTC (permalink / raw)
  To: Johan Hovold, Srinivas Kandagatla, Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
	linux-arm-msm, linux-kernel



On 12/1/25 9:34 AM, Johan Hovold wrote:
> The original wcd938x driver has a couple of OF node reference leaks
> which have been reproduced in the two later added drivers.
> 
> Johan
> 

Thanks for the patches,

Yes, of_parse_phandle() already gets a node refcount, another refcount
is redundant and will leak.

LGTM

Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>

--srini>
> Johan Hovold (3):
>   ASoC: codecs: wcd937x: fix OF node leaks on probe failure
>   ASoC: codecs: wcd938x: fix OF node leaks on probe failure
>   ASoC: codecs: wcd939x: fix OF node leaks on probe failure
> 
>  sound/soc/codecs/wcd937x.c | 4 ++--
>  sound/soc/codecs/wcd938x.c | 3 +--
>  sound/soc/codecs/wcd939x.c | 3 +--
>  3 files changed, 4 insertions(+), 6 deletions(-)
> 



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

* Re: [PATCH 0/3] ASoC: codecs: wcd93xx: fix OF node leaks on probe failure
  2025-12-01  9:34 [PATCH 0/3] ASoC: codecs: wcd93xx: fix OF node leaks on probe failure Johan Hovold
                   ` (3 preceding siblings ...)
  2025-12-01 12:18 ` [PATCH 0/3] ASoC: codecs: wcd93xx: " Srinivas Kandagatla
@ 2025-12-04 13:04 ` Mark Brown
  4 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2025-12-04 13:04 UTC (permalink / raw)
  To: Srinivas Kandagatla, Johan Hovold
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
	linux-arm-msm, linux-kernel

On Mon, 01 Dec 2025 10:34:16 +0100, Johan Hovold wrote:
> The original wcd938x driver has a couple of OF node reference leaks
> which have been reproduced in the two later added drivers.
> 
> Johan
> 
> 
> Johan Hovold (3):
>   ASoC: codecs: wcd937x: fix OF node leaks on probe failure
>   ASoC: codecs: wcd938x: fix OF node leaks on probe failure
>   ASoC: codecs: wcd939x: fix OF node leaks on probe failure
> 
> [...]

Applied to

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

Thanks!

[1/3] ASoC: codecs: wcd937x: fix OF node leaks on probe failure
      commit: 22a03ca7c20c4ed3a75047709b0ad15160e29d58
[2/3] ASoC: codecs: wcd938x: fix OF node leaks on probe failure
      commit: 32ae6ebe171aca9ce10f5790523a9865b6c08b02
[3/3] ASoC: codecs: wcd939x: fix OF node leaks on probe failure
      commit: 3ef4d9ede20db39bff34a559b04a1938fb31251e

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


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

end of thread, other threads:[~2025-12-04 13:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-01  9:34 [PATCH 0/3] ASoC: codecs: wcd93xx: fix OF node leaks on probe failure Johan Hovold
2025-12-01  9:34 ` [PATCH 1/3] ASoC: codecs: wcd937x: " Johan Hovold
2025-12-01  9:34 ` [PATCH 2/3] ASoC: codecs: wcd938x: " Johan Hovold
2025-12-01  9:34 ` [PATCH 3/3] ASoC: codecs: wcd939x: " Johan Hovold
2025-12-01 12:18 ` [PATCH 0/3] ASoC: codecs: wcd93xx: " Srinivas Kandagatla
2025-12-04 13:04 ` Mark Brown

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