[PATCH] clk: samsung: Add check for platform_driver_register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As platform_driver_register() could fail, it should be better
to deal with the return value in order to maintain the code
consisitency.

Fixes: b06a532bf1fa ("clk: samsung: Add Exynos5 sub-CMU clock driver")
Signed-off-by: Jiasheng Jiang <jiasheng@xxxxxxxxxxx>
---
 drivers/clk/samsung/clk-exynos5-subcmu.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos5-subcmu.c b/drivers/clk/samsung/clk-exynos5-subcmu.c
index 65c82d922b05..8b090481a9dc 100644
--- a/drivers/clk/samsung/clk-exynos5-subcmu.c
+++ b/drivers/clk/samsung/clk-exynos5-subcmu.c
@@ -188,8 +188,18 @@ static struct platform_driver exynos5_clk_driver __refdata = {
 
 static int __init exynos5_clk_drv_init(void)
 {
-	platform_driver_register(&exynos5_clk_driver);
-	platform_driver_register(&exynos5_subcmu_driver);
+	int ret;
+
+	ret = platform_driver_register(&exynos5_clk_driver);
+	if (ret)
+		return ret;
+
+	ret = platform_driver_register(&exynos5_subcmu_driver);
+	if (ret) {
+		platform_driver_unregister(&exynos5_clk_driver);
+		return ret;
+	}
+
 	return 0;
 }
 core_initcall(exynos5_clk_drv_init);
-- 
2.25.1




[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux for Synopsys ARC Processors]    
  • [Linux on Unisoc (RDA Micro) SoCs]     [Linux Actions SoC]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  •   Powered by Linux