mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: fsl: pcm030: release the platform node reference
@ 2026-11-03 17:43 Yige Jiang
  0 siblings, 0 replies; only message in thread
From: Yige Jiang @ 2026-11-03 17:43 UTC (permalink / raw)
  To: linux-sound
  Cc: Yige Jiang, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linuxppc-dev

pcm030_fabric_probe() gets a platform node reference and shares it
between two DAI links. Neither probe failures nor card removal
release this reference. The links borrow the node; assigning the
pointer twice does not acquire another reference.

Register a managed put action after acquiring the node. This covers
later probe failures and releases the reference after the card and
codec are unregistered on unbind. If registering the action fails,
the reset variant releases the reference immediately.

Fixes: 084011615c1c ("ASoC: fsl: pcm030-audio-fabric use snd_soc_register_card")
Assisted-by: LLM
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
Based on linux-next next-20261102 (2637bdec0535).
Compile-tested: powerpc, GCC 14.2.0, W=1, CONFIG_OF_DYNAMIC=y.
CONFIG_SND_MPC52xx_SOC_PCM030=m.
Baseline and patched target objects built from this exact base.
No full kernel/module-link, hardware or runtime test was performed.
AI assistance: Codex (LLM) for ownership analysis, code and changelog.

 sound/soc/fsl/pcm030-audio-fabric.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c
index a7a5dba83a2f..64d9f7e34611 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -50,6 +50,11 @@ static struct snd_soc_card pcm030_card = {
 	.num_links = ARRAY_SIZE(pcm030_fabric_dai),
 };
 
+static void pcm030_put_platform_node(void *data)
+{
+	of_node_put(data);
+}
+
 static int pcm030_fabric_probe(struct platform_device *op)
 {
 	struct device_node *np = op->dev.of_node;
@@ -78,6 +83,11 @@ static int pcm030_fabric_probe(struct platform_device *op)
 		return -ENODEV;
 	}
 
+	ret = devm_add_action_or_reset(&op->dev, pcm030_put_platform_node,
+				       platform_np);
+	if (ret)
+		return ret;
+
 	for_each_card_prelinks(card, i, dai_link)
 		dai_link->platforms->of_node = platform_np;
 

base-commit: 2637bdec0535a2044cd830eba9a79363651d9043

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-03 17:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 17:43 [PATCH] ASoC: fsl: pcm030: release the platform node reference Yige Jiang

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®