* [cocci] [PATCH] clk: imx: scu: Use common error handling code in __imx_clk_gpr_scu()
[not found] <20231210171907.3410922-1-visitorckw@gmail.com>
@ 2023-12-22 9:23 ` Markus Elfring
[not found] ` <Zb04UUeE/cU9HtKZ@linaro.org>
0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2023-12-22 9:23 UTC (permalink / raw)
To: Kuan-Wei Chiu, Abel Vesa, Fabio Estevam, Michael Turquette,
Peng Fan, Sascha Hauer, Shawn Guo, Stephen Boyd, kernel,
linux-imx, linux-clk, linux-arm-kernel
Cc: LKML, cocci
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 22 Dec 2023 10:05:32 +0100
Use another label 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/imx/clk-scu.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
index e48a904c0013..4ca9dccf3d3b 100644
--- a/drivers/clk/imx/clk-scu.c
+++ b/drivers/clk/imx/clk-scu.c
@@ -882,19 +882,19 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_na
return ERR_PTR(-ENOMEM);
if (!imx_scu_clk_is_valid(rsrc_id)) {
- kfree(clk_node);
- return ERR_PTR(-EINVAL);
+ ret = -EINVAL;
+ goto free_clk_node;
}
if (!imx_clk_is_resource_owned(rsrc_id)) {
- kfree(clk_node);
- return NULL;
+ ret = 0;
+ goto free_clk_node;
}
clk = kzalloc(sizeof(*clk), GFP_KERNEL);
if (!clk) {
- kfree(clk_node);
- return ERR_PTR(-ENOMEM);
+ ret = -ENOMEM;
+ goto free_clk_node;
}
clk->rsrc_id = rsrc_id;
@@ -922,6 +922,7 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_na
ret = clk_hw_register(NULL, hw);
if (ret) {
kfree(clk);
+free_clk_node:
kfree(clk_node);
hw = ERR_PTR(ret);
} else {
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [cocci] clk: imx: scu: Use common error handling code in __imx_clk_gpr_scu()
[not found] ` <Zb04UUeE/cU9HtKZ@linaro.org>
@ 2024-02-02 20:21 ` Markus Elfring
[not found] ` <ZdxVHLce6mk975Zp@linaro.org>
0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2024-02-02 20:21 UTC (permalink / raw)
To: Abel Vesa, kernel, linux-imx, linux-clk, linux-arm-kernel,
kernel-janitors
Cc: Kuan-Wei Chiu, Abel Vesa, Fabio Estevam, Michael Turquette,
Peng Fan, Sascha Hauer, Shawn Guo, Stephen Boyd, LKML, cocci
>> Use another label so that a bit of exception handling can be better reused
>> at the end of this function.
>
> Please don't send patches as reply to other(s) patches.
This is a general possibility to connect an information sources with
a corresponding change idea.
Will the acceptance grow for the presented source code transformation?
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [cocci] clk: imx: scu: Use common error handling code in __imx_clk_gpr_scu()
[not found] ` <ZdxVHLce6mk975Zp@linaro.org>
@ 2024-02-26 14:35 ` Markus Elfring
0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2024-02-26 14:35 UTC (permalink / raw)
To: Abel Vesa, kernel, linux-imx, linux-clk, linux-arm-kernel,
kernel-janitors
Cc: Kuan-Wei Chiu, Abel Vesa, Fabio Estevam, Michael Turquette,
Peng Fan, Sascha Hauer, Shawn Guo, Stephen Boyd, LKML, cocci
>>>> Use another label so that a bit of exception handling can be better reused
>>>> at the end of this function.
>>>
>>> Please don't send patches as reply to other(s) patches.
>>
>> This is a general possibility to connect an information sources with
>> a corresponding change idea.
>> Will the acceptance grow for the presented source code transformation?
>>
>
> Nope, please don't do that.
Do you find the proposed source code transformation reasonable (in principle)?
> The b4 tool will pick up the old patch if you do this.
Are you looking for further improvements for this development tool?
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-26 14:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20231210171907.3410922-1-visitorckw@gmail.com>
2023-12-22 9:23 ` [cocci] [PATCH] clk: imx: scu: Use common error handling code in __imx_clk_gpr_scu() Markus Elfring
[not found] ` <Zb04UUeE/cU9HtKZ@linaro.org>
2024-02-02 20:21 ` [cocci] " Markus Elfring
[not found] ` <ZdxVHLce6mk975Zp@linaro.org>
2024-02-26 14:35 ` Markus Elfring
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).