Skip to content

Commit 64c6a38

Browse files
tititiou36bebarino
authored andcommitted
clk: hisilicon: hi3559a: Fix an erroneous devm_kfree()
'p_clk' is an array allocated just before the for loop for all clk that need to be registered. It is incremented at each loop iteration. If a clk_register() call fails, 'p_clk' may point to something different from what should be freed. The best we can do, is to avoid this wrong release of memory. Fixes: 6c81966 ("clk: hisilicon: Add clock driver for hi3559A SoC") Signed-off-by: Christophe JAILLET <[email protected]> Link: https://lore.kernel.org/r/773fc8425c3b8f5b0ca7c1d89f15b65831a85ca9.1705850155.git.christophe.jaillet@wanadoo.fr Signed-off-by: Stephen Boyd <[email protected]>
1 parent 74e39f5 commit 64c6a38

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

drivers/clk/hisilicon/clk-hi3559a.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,6 @@ static void hisi_clk_register_pll(struct hi3559av100_pll_clock *clks,
491491

492492
clk = clk_register(NULL, &p_clk->hw);
493493
if (IS_ERR(clk)) {
494-
devm_kfree(dev, p_clk);
495494
dev_err(dev, "%s: failed to register clock %s\n",
496495
__func__, clks[i].name);
497496
continue;

0 commit comments

Comments
 (0)