* [PATCH 0/2] clk: imx: composite-8m: Adjustments for __imx8m_clk_hw_composite()
@ 2023-12-22 16:33 Markus Elfring
2023-12-22 16:35 ` [PATCH 1/2] clk: imx: composite-8m: Less function calls in __imx8m_clk_hw_composite() after error detection Markus Elfring
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Markus Elfring @ 2023-12-22 16:33 UTC (permalink / raw)
To: Abel Vesa, Fabio Estevam, Michael Turquette, Peng Fan,
Sascha Hauer, Shawn Guo, Stephen Boyd, kernel, linux-imx,
linux-clk, linux-arm-kernel, kernel-janitors
Cc: LKML, cocci
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 22 Dec 2023 17:24:32 +0100
A few update suggestions were taken into account
from source code analysis.
Markus Elfring (2):
Less function calls after error detection
Delete two unnecessary initialisations
drivers/clk/imx/clk-composite-8m.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] clk: imx: composite-8m: Less function calls in __imx8m_clk_hw_composite() after error detection
2023-12-22 16:33 [PATCH 0/2] clk: imx: composite-8m: Adjustments for __imx8m_clk_hw_composite() Markus Elfring
@ 2023-12-22 16:35 ` Markus Elfring
2023-12-25 3:17 ` Peng Fan
2023-12-22 16:37 ` [PATCH 2/2] clk: imx: composite-8m: Delete two unnecessary initialisations in __imx8m_clk_hw_composite() Markus Elfring
2024-02-26 9:15 ` [PATCH 0/2] clk: imx: composite-8m: Adjustments for __imx8m_clk_hw_composite() Abel Vesa
2 siblings, 1 reply; 6+ messages in thread
From: Markus Elfring @ 2023-12-22 16:35 UTC (permalink / raw)
To: Abel Vesa, Fabio Estevam, Michael Turquette, Peng Fan,
Sascha Hauer, Shawn Guo, Stephen Boyd, kernel, linux-imx,
linux-clk, linux-arm-kernel, kernel-janitors
Cc: LKML, cocci
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 22 Dec 2023 16:48:24 +0100
The function “kfree” was called in up to three cases
by the function “__imx8m_clk_hw_composite” during error handling
even if the passed variables contained a null pointer.
Adjust jump targets according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/clk/imx/clk-composite-8m.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/clk/imx/clk-composite-8m.c b/drivers/clk/imx/clk-composite-8m.c
index 27a08c50ac1d..eb5392f7a257 100644
--- a/drivers/clk/imx/clk-composite-8m.c
+++ b/drivers/clk/imx/clk-composite-8m.c
@@ -220,7 +220,7 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name,
mux = kzalloc(sizeof(*mux), GFP_KERNEL);
if (!mux)
- goto fail;
+ return ERR_CAST(hw);
mux_hw = &mux->hw;
mux->reg = reg;
@@ -230,7 +230,7 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name,
div = kzalloc(sizeof(*div), GFP_KERNEL);
if (!div)
- goto fail;
+ goto free_mux;
div_hw = &div->hw;
div->reg = reg;
@@ -260,7 +260,7 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name,
if (!mcore_booted) {
gate = kzalloc(sizeof(*gate), GFP_KERNEL);
if (!gate)
- goto fail;
+ goto free_div;
gate_hw = &gate->hw;
gate->reg = reg;
@@ -272,13 +272,15 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name,
mux_hw, mux_ops, div_hw,
divider_ops, gate_hw, &clk_gate_ops, flags);
if (IS_ERR(hw))
- goto fail;
+ goto free_gate;
return hw;
-fail:
+free_gate:
kfree(gate);
+free_div:
kfree(div);
+free_mux:
kfree(mux);
return ERR_CAST(hw);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] clk: imx: composite-8m: Delete two unnecessary initialisations in __imx8m_clk_hw_composite()
2023-12-22 16:33 [PATCH 0/2] clk: imx: composite-8m: Adjustments for __imx8m_clk_hw_composite() Markus Elfring
2023-12-22 16:35 ` [PATCH 1/2] clk: imx: composite-8m: Less function calls in __imx8m_clk_hw_composite() after error detection Markus Elfring
@ 2023-12-22 16:37 ` Markus Elfring
2023-12-25 3:18 ` Peng Fan
2024-02-26 9:15 ` [PATCH 0/2] clk: imx: composite-8m: Adjustments for __imx8m_clk_hw_composite() Abel Vesa
2 siblings, 1 reply; 6+ messages in thread
From: Markus Elfring @ 2023-12-22 16:37 UTC (permalink / raw)
To: Abel Vesa, Fabio Estevam, Michael Turquette, Peng Fan,
Sascha Hauer, Shawn Guo, Stephen Boyd, kernel, linux-imx,
linux-clk, linux-arm-kernel, kernel-janitors
Cc: LKML, cocci
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 22 Dec 2023 17:11:03 +0100
Two local variables will eventually be set to appropriate pointers
a bit later. Thus omit the explicit initialisation at the beginning.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/clk/imx/clk-composite-8m.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/imx/clk-composite-8m.c b/drivers/clk/imx/clk-composite-8m.c
index eb5392f7a257..8cc07d056a83 100644
--- a/drivers/clk/imx/clk-composite-8m.c
+++ b/drivers/clk/imx/clk-composite-8m.c
@@ -212,9 +212,9 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name,
{
struct clk_hw *hw = ERR_PTR(-ENOMEM), *mux_hw;
struct clk_hw *div_hw, *gate_hw = NULL;
- struct clk_divider *div = NULL;
+ struct clk_divider *div;
struct clk_gate *gate = NULL;
- struct clk_mux *mux = NULL;
+ struct clk_mux *mux;
const struct clk_ops *divider_ops;
const struct clk_ops *mux_ops;
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH 1/2] clk: imx: composite-8m: Less function calls in __imx8m_clk_hw_composite() after error detection
2023-12-22 16:35 ` [PATCH 1/2] clk: imx: composite-8m: Less function calls in __imx8m_clk_hw_composite() after error detection Markus Elfring
@ 2023-12-25 3:17 ` Peng Fan
0 siblings, 0 replies; 6+ messages in thread
From: Peng Fan @ 2023-12-25 3:17 UTC (permalink / raw)
To: Markus Elfring, Abel Vesa, Fabio Estevam, Michael Turquette,
Sascha Hauer, Shawn Guo, Stephen Boyd, kernel@pengutronix.de,
dl-linux-imx, linux-clk@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
kernel-janitors@vger.kernel.org
Cc: LKML, cocci@inria.fr
> Subject: [PATCH 1/2] clk: imx: composite-8m: Less function calls in
> __imx8m_clk_hw_composite() after error detection
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 22 Dec 2023 16:48:24 +0100
>
> The function “kfree” was called in up to three cases by the function
> “__imx8m_clk_hw_composite” during error handling even if the passed
> variables contained a null pointer.
>
> Adjust jump targets according to the Linux coding style convention.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH 2/2] clk: imx: composite-8m: Delete two unnecessary initialisations in __imx8m_clk_hw_composite()
2023-12-22 16:37 ` [PATCH 2/2] clk: imx: composite-8m: Delete two unnecessary initialisations in __imx8m_clk_hw_composite() Markus Elfring
@ 2023-12-25 3:18 ` Peng Fan
0 siblings, 0 replies; 6+ messages in thread
From: Peng Fan @ 2023-12-25 3:18 UTC (permalink / raw)
To: Markus Elfring, Abel Vesa, Fabio Estevam, Michael Turquette,
Sascha Hauer, Shawn Guo, Stephen Boyd, kernel@pengutronix.de,
dl-linux-imx, linux-clk@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
kernel-janitors@vger.kernel.org
Cc: LKML, cocci@inria.fr
> Subject: [PATCH 2/2] clk: imx: composite-8m: Delete two unnecessary
> initialisations in __imx8m_clk_hw_composite()
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 22 Dec 2023 17:11:03 +0100
>
> Two local variables will eventually be set to appropriate pointers a bit later.
> Thus omit the explicit initialisation at the beginning.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] clk: imx: composite-8m: Adjustments for __imx8m_clk_hw_composite()
2023-12-22 16:33 [PATCH 0/2] clk: imx: composite-8m: Adjustments for __imx8m_clk_hw_composite() Markus Elfring
2023-12-22 16:35 ` [PATCH 1/2] clk: imx: composite-8m: Less function calls in __imx8m_clk_hw_composite() after error detection Markus Elfring
2023-12-22 16:37 ` [PATCH 2/2] clk: imx: composite-8m: Delete two unnecessary initialisations in __imx8m_clk_hw_composite() Markus Elfring
@ 2024-02-26 9:15 ` Abel Vesa
2 siblings, 0 replies; 6+ messages in thread
From: Abel Vesa @ 2024-02-26 9:15 UTC (permalink / raw)
To: Abel Vesa, Fabio Estevam, Michael Turquette, Peng Fan,
Sascha Hauer, Shawn Guo, Stephen Boyd, kernel, linux-imx,
linux-clk, linux-arm-kernel, kernel-janitors, Markus Elfring
Cc: LKML, cocci
On Fri, 22 Dec 2023 17:33:19 +0100, Markus Elfring wrote:
> A few update suggestions were taken into account
> from source code analysis.
>
> Markus Elfring (2):
> Less function calls after error detection
> Delete two unnecessary initialisations
>
> [...]
Applied, thanks!
[1/2] clk: imx: composite-8m: Less function calls in __imx8m_clk_hw_composite() after error detection
commit: fed6bf52c86df27ad4f39a72cdad8c27da9a50ba
[2/2] clk: imx: composite-8m: Delete two unnecessary initialisations in __imx8m_clk_hw_composite()
commit: e1ed0b0362285981c575f12ae9e8b9dfe56a046c
Best regards,
--
Abel Vesa <abel.vesa@linaro.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-02-26 9:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-22 16:33 [PATCH 0/2] clk: imx: composite-8m: Adjustments for __imx8m_clk_hw_composite() Markus Elfring
2023-12-22 16:35 ` [PATCH 1/2] clk: imx: composite-8m: Less function calls in __imx8m_clk_hw_composite() after error detection Markus Elfring
2023-12-25 3:17 ` Peng Fan
2023-12-22 16:37 ` [PATCH 2/2] clk: imx: composite-8m: Delete two unnecessary initialisations in __imx8m_clk_hw_composite() Markus Elfring
2023-12-25 3:18 ` Peng Fan
2024-02-26 9:15 ` [PATCH 0/2] clk: imx: composite-8m: Adjustments for __imx8m_clk_hw_composite() Abel Vesa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox