linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: bm1880: remove kfrees on static allocations
@ 2021-12-23 15:42 conor.dooley
  2022-01-07  1:46 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: conor.dooley @ 2021-12-23 15:42 UTC (permalink / raw)
  To: mani, Mmturquette, sboyd, linux-clk
  Cc: linux-arm-kernel, linux-kernel, daire.mcnamara, mail, Conor Dooley

From: Conor Dooley <conor.dooley@microchip.com>

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>
---
 drivers/clk/clk-bm1880.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/clk/clk-bm1880.c b/drivers/clk/clk-bm1880.c
index e6d6599d310a..fad78a22218e 100644
--- a/drivers/clk/clk-bm1880.c
+++ b/drivers/clk/clk-bm1880.c
@@ -522,14 +522,6 @@ static struct clk_hw *bm1880_clk_register_pll(struct bm1880_pll_hw_clock *pll_cl
 	return hw;
 }
 
-static void bm1880_clk_unregister_pll(struct clk_hw *hw)
-{
-	struct bm1880_pll_hw_clock *pll_hw = to_bm1880_pll_clk(hw);
-
-	clk_hw_unregister(hw);
-	kfree(pll_hw);
-}
-
 static int bm1880_clk_register_plls(struct bm1880_pll_hw_clock *clks,
 				    int num_clks,
 				    struct bm1880_clock_data *data)
@@ -555,7 +547,7 @@ static int bm1880_clk_register_plls(struct bm1880_pll_hw_clock *clks,
 
 err_clk:
 	while (i--)
-		bm1880_clk_unregister_pll(data->hw_data.hws[clks[i].pll.id]);
+		clk_hw_unregister(data->hw_data.hws[clks[i].pll.id]);
 
 	return PTR_ERR(hw);
 }
@@ -695,14 +687,6 @@ static struct clk_hw *bm1880_clk_register_div(struct bm1880_div_hw_clock *div_cl
 	return hw;
 }
 
-static void bm1880_clk_unregister_div(struct clk_hw *hw)
-{
-	struct bm1880_div_hw_clock *div_hw = to_bm1880_div_clk(hw);
-
-	clk_hw_unregister(hw);
-	kfree(div_hw);
-}
-
 static int bm1880_clk_register_divs(struct bm1880_div_hw_clock *clks,
 				    int num_clks,
 				    struct bm1880_clock_data *data)
@@ -729,7 +713,7 @@ static int bm1880_clk_register_divs(struct bm1880_div_hw_clock *clks,
 
 err_clk:
 	while (i--)
-		bm1880_clk_unregister_div(data->hw_data.hws[clks[i].div.id]);
+		clk_hw_unregister(data->hw_data.hws[clks[i].div.id]);
 
 	return PTR_ERR(hw);
 }
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] clk: bm1880: remove kfrees on static allocations
  2021-12-23 15:42 [PATCH] clk: bm1880: remove kfrees on static allocations conor.dooley
@ 2022-01-07  1:46 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2022-01-07  1:46 UTC (permalink / raw)
  To: Mmturquette, conor.dooley, linux-clk, mani
  Cc: linux-arm-kernel, linux-kernel, daire.mcnamara, mail, Conor Dooley

Quoting conor.dooley@microchip.com (2021-12-23 07:42:44)
> From: Conor Dooley <conor.dooley@microchip.com>
> 
> 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>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-07  1:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-23 15:42 [PATCH] clk: bm1880: remove kfrees on static allocations conor.dooley
2022-01-07  1:46 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).