[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b4bbcc24-b6ca-4fd3-b8cf-7a2088c67795@web.de>
Date: Sun, 24 Dec 2023 17:47:00 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-omap@...r.kernel.org, linux-clk@...r.kernel.org,
kernel-janitors@...r.kernel.org,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Claudiu Beznea <claudiu.beznea@...on.dev>,
Michael Turquette <mturquette@...libre.com>, Rob Herring <robh@...nel.org>,
Stephen Boyd <sboyd@...nel.org>, Tero Kristo <kristo@...nel.org>,
Tony Lindgren <tony@...mide.com>
Cc: LKML <linux-kernel@...r.kernel.org>, cocci@...ia.fr
Subject: [PATCH 07/10] clk: ti: Less function calls in
_ti_omap4_clkctrl_setup() after error detection
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sun, 24 Dec 2023 15:46:04 +0100
The kfree() function was called in a few cases by
the _ti_omap4_clkctrl_setup() function during error handling
even if the passed variable contained a null pointer.
Thus adjust jump targets.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/clk/ti/clkctrl.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
index 607e34d8e289..82b48548818b 100644
--- a/drivers/clk/ti/clkctrl.c
+++ b/drivers/clk/ti/clkctrl.c
@@ -681,11 +681,11 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
reg_data->offset, 0,
legacy_naming);
if (!init.name)
- goto cleanup;
+ goto free_clkctrl_name;
clkctrl_clk = kzalloc(sizeof(*clkctrl_clk), GFP_KERNEL);
if (!clkctrl_clk)
- goto cleanup;
+ goto free_init_name;
init.ops = &omap4_clkctrl_clk_ops;
hw->hw.init = &init;
@@ -711,10 +711,12 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
return;
cleanup:
- kfree(hw);
+ kfree(clkctrl_clk);
+free_init_name:
kfree(init.name);
+free_clkctrl_name:
kfree(clkctrl_name);
- kfree(clkctrl_clk);
+ kfree(hw);
}
CLK_OF_DECLARE(ti_omap4_clkctrl_clock, "ti,clkctrl",
_ti_omap4_clkctrl_setup);
--
2.43.0
Powered by blists - more mailing lists