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

From: Srinivas Kandagatla

Date: Tue Oct 27 2026 - 10:07:50 EST


On 10/25/26 8:16 AM, Tang Bin wrote:
> 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>
> ---


Reviewed-by: Srinivas Kandagatla<srinivas.kandagatla@xxxxxxxxxxxxxxxx>

--Srini


> 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;
> }
>