clk: imx: composite-8m: Adjustments for __imx8m_clk_hw_composite()
cover clk: imx: composite-8m: Adjustments for __imx8m_clk_hw_composite()
From: Markus Elfring <[email protected]>
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
PATCH 1/2 clk: imx: composite-8m: Less function calls in __imx8m_clk_hw_composite() after error detection
From: Markus Elfring <[email protected]>
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.
--- drivers/clk/imx/clk-composite-8m.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/clk/imx/clk-composite-8m.c +7 -5
@@ -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
RE: [PATCH 1/2] clk: imx: composite-8m: Less function calls in __imx8m_clk_hw_composite() after error detection
Quoted 6 lines
Subject: [PATCH 1/2] clk: imx: composite-8m: Less function calls in
__imx8m_clk_hw_composite()after error detectionFrom: Markus Elfring <[email protected]>
Date: Fri, 22 Dec 2023 16:48:24 +0100
Quoted 7 lines
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 <[email protected]>
PATCH 2/2 clk: imx: composite-8m: Delete two unnecessary initialisations in __imx8m_clk_hw_composite()
In reply to Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- drivers/clk/imx/clk-composite-8m.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/imx/clk-composite-8m.c +2 -2
@@ -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
RE: [PATCH 2/2] clk: imx: composite-8m: Delete two unnecessary initialisations in __imx8m_clk_hw_composite()
Quoted 10 lines
Subject: [PATCH 2/2] clk: imx: composite-8m: Delete two unnecessary initialisations in
__imx8m_clk_hw_composite()From: Markus Elfring <[email protected]>
Date: Fri, 22 Dec 2023 17:11:03 +0100Two 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 <[email protected]>
Abel Vesa
AppliedQuoted 8 lines · Markus Elfring
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: e1ed0b0362285981c575f12ae9e8b9dfe56a046cBest regards,
Signature · 1 line
Abel Vesa <[email protected]>