Skip to contentSkip to conversation

ARM: sa1100: Use common error handling code in sa11xx_clk_init()

PATCH New Markus Elfring 1 participant 1 message Jun 10

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: sa1100: Use common error handling code in sa11xx_clk_init()

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.

---
 arch/arm/mach-sa1100/clock.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arm/mach-sa1100/clock.c +8 -8
index eafeb38502af..14d2f37e0895 100644
@@ -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;
 }
Signature · 1 line
2.54.0