[PATCH] ASoC: qcom: storm: Fix of_node_put leak on error path

From: Tang Bin

Date: Sun Oct 25 2026 - 04:16:31 EST


In storm_parse_of(), if the codec phandle is not found, the function
returns -EINVAL without releasing the CPU phandle that was obtained
earlier via of_parse_phandle(). Since storm_dai_link is a static struct,
the leaked reference persists. On a probe retry, the CPU of_node would
be overwritten by a new of_parse_phandle() call, losing the reference
to the previous one.

Fix this by calling of_node_put(dai_link->cpus->of_node) before
returning -EINVAL when the codec phandle is not found.

Fixes: 79119c798649 ("ASoC: qcom: Add Storm machine driver")
Signed-off-by: Tang Bin <tangbin@xxxxxxxxxxxxxxxxxxxx>
---
sound/soc/qcom/storm.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/sound/soc/qcom/storm.c b/sound/soc/qcom/storm.c
index 6b42fbfd2..6a42876ce 100644
--- a/sound/soc/qcom/storm.c
+++ b/sound/soc/qcom/storm.c
@@ -79,6 +79,7 @@ static int storm_parse_of(struct device *dev)
dai_link->codecs->of_node = of_parse_phandle(np, "codec", 0);
if (!dai_link->codecs->of_node) {
dev_err(dev, "error getting codec phandle\n");
+ of_node_put(dai_link->cpus->of_node);
return -EINVAL;
}

--
2.52.0.windows.1