From patchwork Thu May 26 10:12:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 577689 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 882D2C433FE for ; Thu, 26 May 2022 10:20:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347050AbiEZKUO (ORCPT ); Thu, 26 May 2022 06:20:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344467AbiEZKUB (ORCPT ); Thu, 26 May 2022 06:20:01 -0400 X-Greylist: delayed 438 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 26 May 2022 03:19:59 PDT Received: from cstnet.cn (smtp84.cstnet.cn [159.226.251.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 80494CC154; Thu, 26 May 2022 03:19:58 -0700 (PDT) Received: from localhost.localdomain (unknown [124.16.138.126]) by APP-05 (Coremail) with SMTP id zQCowAAnxxiBUo9iwleiCg--.21840S2; Thu, 26 May 2022 18:12:18 +0800 (CST) From: Jiasheng Jiang To: s.nawrocki@samsung.com, tomasz.figa@gmail.com, cw00.choi@samsung.com, alim.akhtar@samsung.com, mturquette@baylibre.com, sboyd@kernel.org, krzysztof.kozlowski@linaro.org Cc: linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] clk: samsung: Add check for platform_driver_register Date: Thu, 26 May 2022 18:12:15 +0800 Message-Id: <20220526101215.1519155-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 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vjDU0xZFpf9x0J UdHUDUUUUU= X-Originating-IP: [124.16.138.126] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org 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 Reviewed-by: Stephen Boyd --- 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);