Skip to content

Commit be530c3

Browse files
tititiou36bebarino
authored andcommitted
clk: mediatek: mt6735-apmixedsys: Fix an error handling path in clk_mt6735_apmixed_probe()
If an error occurs after a successful mtk_alloc_clk_data(), mtk_free_clk_data() should be called, as already done in the .remove() function. Switch to mtk_devm_alloc_clk_data() in order to fix the memory leak in the probe function, and simplify the remove function. Fixes: 43c04ed ("clk: mediatek: Add drivers for MediaTek MT6735 main clock and reset drivers") Signed-off-by: Christophe JAILLET <[email protected]> Link: https://lore.kernel.org/r/89ad840e7a484eaf4727470824acfe0fdc60fcef.1729871146.git.christophe.jaillet@wanadoo.fr Tested-by: Yassine Oudjana <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 198675b commit be530c3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/clk/mediatek/clk-mt6735-apmixedsys.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static int clk_mt6735_apmixed_probe(struct platform_device *pdev)
8888
if (IS_ERR(base))
8989
return PTR_ERR(base);
9090

91-
clk_data = mtk_alloc_clk_data(ARRAY_SIZE(apmixedsys_plls));
91+
clk_data = mtk_devm_alloc_clk_data(&pdev->dev, ARRAY_SIZE(apmixedsys_plls));
9292
if (!clk_data)
9393
return -ENOMEM;
9494
platform_set_drvdata(pdev, clk_data);
@@ -114,7 +114,6 @@ static void clk_mt6735_apmixed_remove(struct platform_device *pdev)
114114
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
115115

116116
mtk_clk_unregister_plls(apmixedsys_plls, ARRAY_SIZE(apmixedsys_plls), clk_data);
117-
mtk_free_clk_data(clk_data);
118117
}
119118

120119
static const struct of_device_id of_match_mt6735_apmixedsys[] = {

0 commit comments

Comments
 (0)