From: Jiasheng Jiang <jiasheng@iscas.ac.cn> 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 <jiasheng@iscas.ac.cn> Subject: [PATCH] clk: samsung: Add check for platform_driver_register Date: Thu, 26 May 2022 18:12:15 +0800 [thread overview] Message-ID: <20220526101215.1519155-1-jiasheng@iscas.ac.cn> (raw) 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@iscas.ac.cn> --- 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
WARNING: multiple messages have this Message-ID (diff)
From: Jiasheng Jiang <jiasheng@iscas.ac.cn> 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 <jiasheng@iscas.ac.cn> Subject: [PATCH] clk: samsung: Add check for platform_driver_register Date: Thu, 26 May 2022 18:12:15 +0800 [thread overview] Message-ID: <20220526101215.1519155-1-jiasheng@iscas.ac.cn> (raw) 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@iscas.ac.cn> --- 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2022-05-26 10:13 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <CGME20220526101239epcas1p33aec5e8e0386d6b986ffb16bc3f68bab@epcas1p3.samsung.com> 2022-05-26 10:12 ` Jiasheng Jiang [this message] 2022-05-26 10:12 ` [PATCH] clk: samsung: Add check for platform_driver_register Jiasheng Jiang 2022-05-27 9:09 ` Chanwoo Choi 2022-05-27 9:09 ` Chanwoo Choi 2022-06-16 0:07 ` Stephen Boyd 2022-06-16 0:07 ` Stephen Boyd
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220526101215.1519155-1-jiasheng@iscas.ac.cn \ --to=jiasheng@iscas.ac.cn \ --cc=alim.akhtar@samsung.com \ --cc=cw00.choi@samsung.com \ --cc=krzysztof.kozlowski@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-clk@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-samsung-soc@vger.kernel.org \ --cc=mturquette@baylibre.com \ --cc=s.nawrocki@samsung.com \ --cc=sboyd@kernel.org \ --cc=tomasz.figa@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.