mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-06 17:35:20 +02:00
clk: imx: composite-8m: Less function calls in __imx8m_clk_hw_composite() after error detection
[ Upstream commitfed6bf52c8
] 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> Link: https://lore.kernel.org/r/147ca1e6-69f3-4586-b5b3-b69f9574a862@web.de Signed-off-by: Abel Vesa <abel.vesa@linaro.org> Stable-dep-of:8f32e9dd09
("clk: imx: composite-8m: Enable gate clk with mcore_booted") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c2ee6de22d
commit
554c590d22
|
@ -220,7 +220,7 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name,
|
||||||
|
|
||||||
mux = kzalloc(sizeof(*mux), GFP_KERNEL);
|
mux = kzalloc(sizeof(*mux), GFP_KERNEL);
|
||||||
if (!mux)
|
if (!mux)
|
||||||
goto fail;
|
return ERR_CAST(hw);
|
||||||
|
|
||||||
mux_hw = &mux->hw;
|
mux_hw = &mux->hw;
|
||||||
mux->reg = reg;
|
mux->reg = reg;
|
||||||
|
@ -230,7 +230,7 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name,
|
||||||
|
|
||||||
div = kzalloc(sizeof(*div), GFP_KERNEL);
|
div = kzalloc(sizeof(*div), GFP_KERNEL);
|
||||||
if (!div)
|
if (!div)
|
||||||
goto fail;
|
goto free_mux;
|
||||||
|
|
||||||
div_hw = &div->hw;
|
div_hw = &div->hw;
|
||||||
div->reg = reg;
|
div->reg = reg;
|
||||||
|
@ -260,7 +260,7 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name,
|
||||||
if (!mcore_booted) {
|
if (!mcore_booted) {
|
||||||
gate = kzalloc(sizeof(*gate), GFP_KERNEL);
|
gate = kzalloc(sizeof(*gate), GFP_KERNEL);
|
||||||
if (!gate)
|
if (!gate)
|
||||||
goto fail;
|
goto free_div;
|
||||||
|
|
||||||
gate_hw = &gate->hw;
|
gate_hw = &gate->hw;
|
||||||
gate->reg = reg;
|
gate->reg = reg;
|
||||||
|
@ -272,13 +272,15 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name,
|
||||||
mux_hw, mux_ops, div_hw,
|
mux_hw, mux_ops, div_hw,
|
||||||
divider_ops, gate_hw, &clk_gate_ops, flags);
|
divider_ops, gate_hw, &clk_gate_ops, flags);
|
||||||
if (IS_ERR(hw))
|
if (IS_ERR(hw))
|
||||||
goto fail;
|
goto free_gate;
|
||||||
|
|
||||||
return hw;
|
return hw;
|
||||||
|
|
||||||
fail:
|
free_gate:
|
||||||
kfree(gate);
|
kfree(gate);
|
||||||
|
free_div:
|
||||||
kfree(div);
|
kfree(div);
|
||||||
|
free_mux:
|
||||||
kfree(mux);
|
kfree(mux);
|
||||||
return ERR_CAST(hw);
|
return ERR_CAST(hw);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user