Skip to content

Commit 3327d72

Browse files
wangyufen316broonie
authored andcommitted
ASoC: mediatek: mt8173-rt5650-rt5514: fix refcount leak in mt8173_rt5650_rt5514_dev_probe()
The node returned by of_parse_phandle() with refcount incremented, of_node_put() needs be called when finish using it. So add it in the error path in mt8173_rt5650_rt5514_dev_probe(). Fixes: 0d1d7a6 ("ASoC: mediatek: Refine mt8173 driver and change config option") Signed-off-by: Wang Yufen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 8e378ea commit 3327d72

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,16 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev)
200200
if (!mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S].codecs[0].of_node) {
201201
dev_err(&pdev->dev,
202202
"Property 'audio-codec' missing or invalid\n");
203-
return -EINVAL;
203+
ret = -EINVAL;
204+
goto out;
204205
}
205206
mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node =
206207
of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 1);
207208
if (!mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node) {
208209
dev_err(&pdev->dev,
209210
"Property 'audio-codec' missing or invalid\n");
210-
return -EINVAL;
211+
ret = -EINVAL;
212+
goto out;
211213
}
212214
mt8173_rt5650_rt5514_codec_conf[0].dlc.of_node =
213215
mt8173_rt5650_rt5514_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node;
@@ -216,6 +218,7 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev)
216218

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

221+
out:
219222
of_node_put(platform_node);
220223
return ret;
221224
}

0 commit comments

Comments
 (0)