Skip to content

Commit c4b7174

Browse files
Yuuoniybroonie
authored andcommitted
ASoC: mediatek: mt8195: Fix error handling in mt8195_mt6359_rt1019_rt5682_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>
1 parent abed17f commit c4b7174

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,8 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev)
13421342
"mediatek,dai-link");
13431343
if (ret) {
13441344
dev_dbg(&pdev->dev, "Parse dai-link fail\n");
1345-
return -EINVAL;
1345+
ret = -EINVAL;
1346+
goto put_node;
13461347
}
13471348
} else {
13481349
if (!sof_on)
@@ -1398,6 +1399,7 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev)
13981399

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

1402+
put_node:
14011403
of_node_put(platform_node);
14021404
of_node_put(adsp_node);
14031405
of_node_put(dp_node);

0 commit comments

Comments
 (0)