[PATCH] ARM: sa1100: Use common error handling code in sa11xx_clk_init()
Markus Elfring <[email protected]> Wed, 10 Jun 2026 09:48:05 +0200
| Newsgroups | org.kernel.vger.kernel-janitors,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
From: Markus Elfring <[email protected]> Date: Wed, 10 Jun 2026 09:40:04 +0200 Use an additional label so that a bit of exception handling can be better reused at the end of this function implementation. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <[email protected]> --- arch/arm/mach-sa1100/clock.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c index eafeb38502af..14d2f37e0895 100644 --- a/arch/arm/mach-sa1100/clock.c +++ b/arch/arm/mach-sa1100/clock.c @@ -112,10 +112,8 @@ int __init sa11xx_clk_init(void) return -ENOMEM; hw->init = &clk_mpll_init_data; ret = clk_hw_register(NULL, hw); - if (ret) { - kfree(hw); - return ret; - } + if (ret) + goto free_hw; clk_hw_register_clkdev(hw, NULL, "sa11x0-fb"); clk_hw_register_clkdev(hw, NULL, "sa11x0-pcmcia"); @@ -134,12 +132,14 @@ int __init sa11xx_clk_init(void) return -ENOMEM; hw->init = &clk_gpio27_init_data; ret = clk_hw_register(NULL, hw); - if (ret) { - kfree(hw); - return ret; - } + if (ret) + goto free_hw; clk_hw_register_clkdev(hw, NULL, "sa1111.0"); return 0; + +free_hw: + kfree(hw); + return ret; } -- 2.54.0