Skip to contentSkip to conversation

ASoC: fsl: pcm030: release the platform node reference

PATCH In review Yige Jiang 2 participants 2 messages Nov 3 – Nov 4

Subsystems (2)
lore
Share & tools
lore

Yige Jiang

author
#0 lore raw

PATCH 1/1 ASoC: fsl: pcm030: release the platform node reference

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

---
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(+)
sound/soc/fsl/pcm030-audio-fabric.c +10 -0
index a7a5dba83a2f..64d9f7e34611 100644
@@ -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

maintainer
#1 lore raw
Quoted 1 line · Yige Jiang

ASoC: fsl: pcm030: release the platform node reference

Applied to

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

Thanks!

[1/1] ASoC: fsl: pcm030: release the platform node reference

      https://git.kernel.org/broonie/sound/c/c526eaad1ada

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