Skip to content

Commit

Permalink
ASoC: mediatek: mt8195: Fix error handling in mt8195_mt6359_rt1019_rt…
Browse files Browse the repository at this point in the history
…5682_dev_probe

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

This function only calls of_node_put() in the regular path.
And it will cause refcount leak in error path.

Fixes: 082482a ("ASoC: mediatek: mt8195: release device_node after snd_soc_register_card")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220316084623.24238-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Miaoqian Lin authored and Mark Brown committed Mar 16, 2022
1 parent abed17f commit c4b7174
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,8 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev)
"mediatek,dai-link");
if (ret) {
dev_dbg(&pdev->dev, "Parse dai-link fail\n");
return -EINVAL;
ret = -EINVAL;
goto put_node;
}
} else {
if (!sof_on)
Expand Down Expand Up @@ -1398,6 +1399,7 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev)

ret = devm_snd_soc_register_card(&pdev->dev, card);

put_node:
of_node_put(platform_node);
of_node_put(adsp_node);
of_node_put(dp_node);
Expand Down

0 comments on commit c4b7174

Please sign in to comment.