[PATCH] fix: sound/soc/qcom: qcom_snd_parse_of: leaked device_node reference from of_parse_phandle on error path

From: WenTao Liang

Date: Fri Jun 26 2026 - 23:49:40 EST


In qcom_snd_parse_of(), of_parse_phandle() at line 124 acquires a
reference on the platform's sound-dai node, stored in
link->platforms->of_node. When codec initialization fails (goto err), the
err label releases cpu, codec, and platform from of_get_child_by_name(),
but does not release link->platforms->of_node from of_parse_phandle(),
causing a device_node reference leak.

Add of_node_put(link->platforms->of_node) in the err label.

Cc: stable@xxxxxxxxxxxxxxx
Fixes: c25e295cd77b ("ASoC: qcom: Add support to parse common audio device nodes")
Signed-off-by: WenTao Liang <vulab@xxxxxxxxxxx>
---
sound/soc/qcom/common.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index cf1f3a767cee..8f7498290f81 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -180,6 +180,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card)

return 0;
err:
+ of_node_put(link->platforms->of_node);
of_node_put(cpu);
of_node_put(codec);
of_node_put(platform);
--
2.39.5 (Apple Git-154)