Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: sa1100: Use common error handling code in sa11xx_clk_init()
@ 2026-06-10  7:48 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2026-06-10  7:48 UTC (permalink / raw)
  To: linux-arm-kernel, Kees Cook, Russell King; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-10  7:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-10  7:48 [PATCH] ARM: sa1100: Use common error handling code in sa11xx_clk_init() Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox