Skip to content

Commit c861c1b

Browse files
ConchuODbebarino
authored andcommitted
clk: bm1880: remove kfrees on static allocations
bm1880_clk_unregister_pll & bm1880_clk_unregister_div both try to free statically allocated variables, so remove those kfrees. For example, if we take L703 kfree(div_hw): - div_hw is a bm1880_div_hw_clock pointer - in bm1880_clk_register_plls this is pointed to an element of arg1: struct bm1880_div_hw_clock *clks - in the probe, where bm1880_clk_register_plls is called arg1 is bm1880_div_clks, defined on L371: static struct bm1880_div_hw_clock bm1880_div_clks[] Signed-off-by: Conor Dooley <conor.dooley@microchip.com> Fixes: 1ab4601 ("clk: Add common clock driver for BM1880 SoC") Link: https://lore.kernel.org/r/20211223154244.1024062-1-conor.dooley@microchip.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent fa55b7d commit c861c1b

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

drivers/clk/clk-bm1880.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -522,14 +522,6 @@ static struct clk_hw *bm1880_clk_register_pll(struct bm1880_pll_hw_clock *pll_cl
522522
return hw;
523523
}
524524

525-
static void bm1880_clk_unregister_pll(struct clk_hw *hw)
526-
{
527-
struct bm1880_pll_hw_clock *pll_hw = to_bm1880_pll_clk(hw);
528-
529-
clk_hw_unregister(hw);
530-
kfree(pll_hw);
531-
}
532-
533525
static int bm1880_clk_register_plls(struct bm1880_pll_hw_clock *clks,
534526
int num_clks,
535527
struct bm1880_clock_data *data)
@@ -555,7 +547,7 @@ static int bm1880_clk_register_plls(struct bm1880_pll_hw_clock *clks,
555547

556548
err_clk:
557549
while (i--)
558-
bm1880_clk_unregister_pll(data->hw_data.hws[clks[i].pll.id]);
550+
clk_hw_unregister(data->hw_data.hws[clks[i].pll.id]);
559551

560552
return PTR_ERR(hw);
561553
}
@@ -695,14 +687,6 @@ static struct clk_hw *bm1880_clk_register_div(struct bm1880_div_hw_clock *div_cl
695687
return hw;
696688
}
697689

698-
static void bm1880_clk_unregister_div(struct clk_hw *hw)
699-
{
700-
struct bm1880_div_hw_clock *div_hw = to_bm1880_div_clk(hw);
701-
702-
clk_hw_unregister(hw);
703-
kfree(div_hw);
704-
}
705-
706690
static int bm1880_clk_register_divs(struct bm1880_div_hw_clock *clks,
707691
int num_clks,
708692
struct bm1880_clock_data *data)
@@ -729,7 +713,7 @@ static int bm1880_clk_register_divs(struct bm1880_div_hw_clock *clks,
729713

730714
err_clk:
731715
while (i--)
732-
bm1880_clk_unregister_div(data->hw_data.hws[clks[i].div.id]);
716+
clk_hw_unregister(data->hw_data.hws[clks[i].div.id]);
733717

734718
return PTR_ERR(hw);
735719
}

0 commit comments

Comments
 (0)