of_find_device_by_node() takes a reference to the embedded struct device,
but fsl_asoc_card_probe() never drops it. The reference is leaked on the
successful path as well as on every error path taken after the lookup.
Release the reference at the asrc_fail label, which is reached on both
success and failure.
Fixes: 708b4351f08c ("ASoC: fsl: Add Freescale Generic ASoC Sound Card with
ASRC support")
Cc: [email protected]
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <[email protected]>
---
sound/soc/fsl/fsl-asoc-card.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index 310ee4c282a1..d361bb58fdb1 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -1378,6 +1378,8 @@ static int fsl_asoc_card_probe(struct platform_device
*pdev)
}
asrc_fail:
+ if (asrc_pdev)
+ put_device(&asrc_pdev->dev);
of_node_put(asrc_np);
of_node_put(codec_np[0]);
of_node_put(codec_np[1]);
--
2.34.1