diff mbox series

clk: ti: fix double free in of_ti_divider_clk_setup()

Message ID 6d36eeec-6c8a-4f11-a579-aa3cd7c38749@moroto.mountain
State New
Headers show
Series clk: ti: fix double free in of_ti_divider_clk_setup() | expand

Commit Message

Dan Carpenter Oct. 2, 2023, 7:04 a.m. UTC
The "div" pointer is freed in _register_divider() and again in
of_ti_divider_clk_setup().  Delete the free in _register_divider()

Fixes: fbbc18591585 ("clk: ti: divider: cleanup _register_divider and ti_clk_get_div_table")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/clk/ti/divider.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Tony Lindgren Oct. 7, 2023, 7:21 a.m. UTC | #1
* Dan Carpenter <dan.carpenter@linaro.org> [231002 10:04]:
> The "div" pointer is freed in _register_divider() and again in
> of_ti_divider_clk_setup().  Delete the free in _register_divider()

Reviewed-by: Tony Lindgren <tony@atomide.com>
Stephen Boyd Oct. 19, 2023, 12:54 a.m. UTC | #2
Quoting Dan Carpenter (2023-10-02 00:04:36)
> The "div" pointer is freed in _register_divider() and again in
> of_ti_divider_clk_setup().  Delete the free in _register_divider()
> 
> Fixes: fbbc18591585 ("clk: ti: divider: cleanup _register_divider and ti_clk_get_div_table")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---

Applied to clk-next
diff mbox series

Patch

diff --git a/drivers/clk/ti/divider.c b/drivers/clk/ti/divider.c
index 768a1f3398b4..5d5bb123ba94 100644
--- a/drivers/clk/ti/divider.c
+++ b/drivers/clk/ti/divider.c
@@ -309,7 +309,6 @@  static struct clk *_register_divider(struct device_node *node,
 				     u32 flags,
 				     struct clk_omap_divider *div)
 {
-	struct clk *clk;
 	struct clk_init_data init;
 	const char *parent_name;
 	const char *name;
@@ -326,12 +325,7 @@  static struct clk *_register_divider(struct device_node *node,
 	div->hw.init = &init;
 
 	/* register the clock */
-	clk = of_ti_clk_register(node, &div->hw, name);
-
-	if (IS_ERR(clk))
-		kfree(div);
-
-	return clk;
+	return of_ti_clk_register(node, &div->hw, name);
 }
 
 int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,