mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: cpcap: use the platform OF node setter
@ 2026-11-05 12:32 Yige Jiang
  2026-11-05 14:02 ` Bartosz Golaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: Yige Jiang @ 2026-11-05 12:32 UTC (permalink / raw)
  To: brgl
  Cc: Yige Jiang, linux-sound, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-kernel

cpcap_codec_probe() gets the audio-codec child node and assigns it
only to dev.of_node. Platform device release now puts dev.fwnode,
so the acquired node reference is never returned.

Use platform_device_set_of_node() to synchronize both fields and
give the device its own reference. Use __free(device_node) to release
the local lookup reference when probe returns. The device keeps the
node until it is replaced or the platform device is released; a probe
retry also drops the old device-owned reference.

Fixes: 7b5b51b2b05c ("driver core: platform: count references to all kinds of firmware nodes")
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
Changes in v2:
- Use __free(device_node) for the local lookup reference instead of
  an explicit of_node_put(), as suggested by Bartosz Golaszewski.
- Remove the Assisted-by trailer and keep a plain-text AI disclosure.

v1: https://lore.kernel.org/r/rc-review-20261103-28-afc55c614a25@gmail.com

Based on linux-next next-20261102 (2637bdec0535).
Compile-tested: arm64, GCC 14.2.0, W=1, CONFIG_OF_DYNAMIC=y.
COMPILE_TEST=y.
Baseline and v2 target objects built from this exact base.
No full kernel/module-link, hardware or runtime test was performed.
AI assistance was used for analysis and patch preparation.

 sound/soc/codecs/cpcap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/cpcap.c b/sound/soc/codecs/cpcap.c
index eaaf141dea57e3d14078c47350c1c4daaa0662b6..0e7c05f5bab607f8c4fb17d493e578b831a32f84 100644
--- a/sound/soc/codecs/cpcap.c
+++ b/sound/soc/codecs/cpcap.c
@@ -1754,14 +1754,14 @@ static const struct snd_soc_component_driver soc_codec_dev_cpcap = {
 
 static int cpcap_codec_probe(struct platform_device *pdev)
 {
-	struct device_node *codec_node =
+	struct device_node *codec_node __free(device_node) =
 		of_get_child_by_name(pdev->dev.parent->of_node, "audio-codec");
 	struct cpcap_audio *cpcap;
 
 	if (!codec_node)
 		return -ENODEV;
 
-	pdev->dev.of_node = codec_node;
+	platform_device_set_of_node(pdev, codec_node);
 
 	cpcap = devm_kzalloc(&pdev->dev, sizeof(*cpcap), GFP_KERNEL);
 	if (!cpcap)

base-commit: 2637bdec0535a2044cd830eba9a79363651d9043

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

* Re: [PATCH v2] ASoC: cpcap: use the platform OF node setter
  2026-11-05 12:32 [PATCH v2] ASoC: cpcap: use the platform OF node setter Yige Jiang
@ 2026-11-05 14:02 ` Bartosz Golaszewski
  0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2026-11-05 14:02 UTC (permalink / raw)
  To: Yige Jiang
  Cc: linux-sound, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel

On Thu, Nov 05, 2026 at 08:32:28PM +0800, Yige Jiang wrote:
> cpcap_codec_probe() gets the audio-codec child node and assigns it
> only to dev.of_node. Platform device release now puts dev.fwnode,
> so the acquired node reference is never returned.
> 
> Use platform_device_set_of_node() to synchronize both fields and
> give the device its own reference. Use __free(device_node) to release
> the local lookup reference when probe returns. The device keeps the
> node until it is replaced or the platform device is released; a probe
> retry also drops the old device-owned reference.
> 
> Fixes: 7b5b51b2b05c ("driver core: platform: count references to all kinds of firmware nodes")
> Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
> ---

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

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

end of thread, other threads:[~2026-11-05 14:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 12:32 [PATCH v2] ASoC: cpcap: use the platform OF node setter Yige Jiang
2026-11-05 14:02 ` Bartosz Golaszewski

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®