From: Markus Elfring <Markus.Elfring@web.de>
To: linux-omap@vger.kernel.org, linux-clk@vger.kernel.org,
kernel-janitors@vger.kernel.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
Michael Turquette <mturquette@baylibre.com>,
Rob Herring <robh@kernel.org>, Stephen Boyd <sboyd@kernel.org>,
Tero Kristo <kristo@kernel.org>, Tony Lindgren <tony@atomide.com>
Cc: LKML <linux-kernel@vger.kernel.org>, cocci@inria.fr
Subject: [PATCH 08/10] clk: ti: Use common error handling code in _ti_omap4_clkctrl_setup()
Date: Sun, 24 Dec 2023 17:48:20 +0100 [thread overview]
Message-ID: <0a9cd717-0909-4bc2-b78c-73fe9f661156@web.de> (raw)
In-Reply-To: <20849a8e-e0f5-46df-ad8a-9eae6cbe337b@web.de>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 24 Dec 2023 15:56:08 +0100
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/clk/ti/clkctrl.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
index 82b48548818b..5a1bd176160c 100644
--- a/drivers/clk/ti/clkctrl.c
+++ b/drivers/clk/ti/clkctrl.c
@@ -590,10 +590,9 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
if (clkctrl_name) {
provider->clkdm_name = kasprintf(GFP_KERNEL,
"%s_clkdm", clkctrl_name);
- if (!provider->clkdm_name) {
- kfree(provider);
- return;
- }
+ if (!provider->clkdm_name)
+ goto free_provider;
+
goto clkdm_found;
}
@@ -603,10 +602,8 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
*/
if (legacy_naming) {
provider->clkdm_name = kasprintf(GFP_KERNEL, "%pOFnxxx", node->parent);
- if (!provider->clkdm_name) {
- kfree(provider);
- return;
- }
+ if (!provider->clkdm_name)
+ goto free_provider;
/*
* Create default clkdm name, replace _cm from end of parent
@@ -615,10 +612,8 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
provider->clkdm_name[strlen(provider->clkdm_name) - 2] = 0;
} else {
provider->clkdm_name = kasprintf(GFP_KERNEL, "%pOFn", node);
- if (!provider->clkdm_name) {
- kfree(provider);
- return;
- }
+ if (!provider->clkdm_name)
+ goto free_provider;
/*
* Create default clkdm name, replace _clkctrl from end of
@@ -710,4 +705,8 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
return;
+free_provider:
+ kfree(provider);
+ return;
+
cleanup:
--
2.43.0
next prev parent reply other threads:[~2023-12-24 16:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-24 16:33 [PATCH 00/10] clk: ti: Adjustments for eight function implementations Markus Elfring
2023-12-24 16:36 ` [PATCH 01/10] clk: ti: Less function calls in of_omap2_apll_setup() after error detection Markus Elfring
2023-12-27 16:38 ` Andy Shevchenko
2023-12-24 16:38 ` [PATCH 02/10] clk: ti: Less function calls in of_dra7_apll_setup() " Markus Elfring
2023-12-24 16:40 ` [PATCH 03/10] clk: ti: Use common code in omap_clk_register_apll() Markus Elfring
2023-12-24 16:42 ` [PATCH 04/10] clk: ti: Less function calls in ti_fapll_setup() after error detection Markus Elfring
2023-12-24 16:44 ` [PATCH 05/10] clk: ti: One function call less in ti_fapll_synth_setup() " Markus Elfring
2023-12-24 16:45 ` [PATCH 06/10] clk: ti: Return directly after a failed kzalloc() in of_mux_clk_setup() Markus Elfring
2023-12-24 16:47 ` [PATCH 07/10] clk: ti: Less function calls in _ti_omap4_clkctrl_setup() after error detection Markus Elfring
2023-12-24 16:48 ` Markus Elfring [this message]
2023-12-24 16:50 ` [PATCH 09/10] clk: ti: Less function calls in _ti_clkctrl_clk_register() " Markus Elfring
2023-12-28 5:18 ` kernel test robot
2023-12-28 6:39 ` [09/10] " Markus Elfring
2023-12-24 16:52 ` [PATCH 10/10] clk: ti: Delete an unnecessary initialisation in _ti_clkctrl_clk_register() Markus Elfring
2023-12-27 16:39 ` [PATCH 00/10] clk: ti: Adjustments for eight function implementations Andy Shevchenko
2024-02-20 9:27 ` Tony Lindgren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0a9cd717-0909-4bc2-b78c-73fe9f661156@web.de \
--to=markus.elfring@web.de \
--cc=andriy.shevchenko@linux.intel.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=cocci@inria.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=kristo@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox