[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b11039e4-69c6-4247-b4ba-c442b9427231@web.de>
Date: Sun, 24 Dec 2023 17:50:42 +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 09/10] clk: ti: Less function calls in
_ti_clkctrl_clk_register() after error detection
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sun, 24 Dec 2023 16:06:34 +0100
The kfree() function was called in a few cases by
the of_omap2_apll_setup() function during error handling
even if the passed variable contained a null pointer.
* Split a condition check.
* Adjust jump targets.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/clk/ti/clkctrl.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
index 5a1bd176160c..cdc3cf1ddddf 100644
--- a/drivers/clk/ti/clkctrl.c
+++ b/drivers/clk/ti/clkctrl.c
@@ -296,11 +296,13 @@ _ti_clkctrl_clk_register(struct omap_clkctrl_provider *provider,
init.name = clkctrl_get_clock_name(node, clkctrl_name, offset, bit,
ti_clk_get_features()->flags &
TI_CLK_CLKCTRL_COMPAT);
+ if (!init.name)
+ return -ENOMEM;
clkctrl_clk = kzalloc(sizeof(*clkctrl_clk), GFP_KERNEL);
- if (!init.name || !clkctrl_clk) {
+ if (!clkctrl_clk) {
ret = -ENOMEM;
- goto cleanup;
+ goto free_init_name;
}
clk_hw->init = &init;
@@ -324,8 +326,9 @@ _ti_clkctrl_clk_register(struct omap_clkctrl_provider *provider,
return 0;
cleanup:
- kfree(init.name);
kfree(clkctrl_clk);
+free_init_name;
+ kfree(init.name);
return ret;
}
--
2.43.0
Powered by blists - more mailing lists