All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: keystone: pll: fix a couple NULL vs IS_ERR() checks
@ 2023-10-05 14:01 Dan Carpenter
  2023-10-19  0:53 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2023-10-05 14:01 UTC (permalink / raw)
  To: Santosh Shilimkar
  Cc: Santosh Shilimkar, Michael Turquette, Stephen Boyd,
	Mike Turquette, linux-kernel, linux-clk, kernel-janitors

The clk_register_divider() and clk_register_mux() functions returns
error pointers on error but this code checks for NULL.  Fix that.

Fixes: b9e0d40c0d83 ("clk: keystone: add Keystone PLL clock driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/clk/keystone/pll.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c
index ee5c72369334..6bbdd4705d71 100644
--- a/drivers/clk/keystone/pll.c
+++ b/drivers/clk/keystone/pll.c
@@ -281,12 +281,13 @@ static void __init of_pll_div_clk_init(struct device_node *node)
 
 	clk = clk_register_divider(NULL, clk_name, parent_name, 0, reg, shift,
 				 mask, 0, NULL);
-	if (clk) {
-		of_clk_add_provider(node, of_clk_src_simple_get, clk);
-	} else {
+	if (IS_ERR(clk)) {
 		pr_err("%s: error registering divider %s\n", __func__, clk_name);
 		iounmap(reg);
+		return;
 	}
+
+	of_clk_add_provider(node, of_clk_src_simple_get, clk);
 }
 CLK_OF_DECLARE(pll_divider_clock, "ti,keystone,pll-divider-clock", of_pll_div_clk_init);
 
@@ -328,10 +329,12 @@ static void __init of_pll_mux_clk_init(struct device_node *node)
 	clk = clk_register_mux(NULL, clk_name, (const char **)&parents,
 				ARRAY_SIZE(parents) , 0, reg, shift, mask,
 				0, NULL);
-	if (clk)
-		of_clk_add_provider(node, of_clk_src_simple_get, clk);
-	else
+	if (IS_ERR(clk)) {
 		pr_err("%s: error registering mux %s\n", __func__, clk_name);
+		return;
+	}
+
+	of_clk_add_provider(node, of_clk_src_simple_get, clk);
 }
 CLK_OF_DECLARE(pll_mux_clock, "ti,keystone,pll-mux-clock", of_pll_mux_clk_init);
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] clk: keystone: pll: fix a couple NULL vs IS_ERR() checks
  2023-10-05 14:01 [PATCH] clk: keystone: pll: fix a couple NULL vs IS_ERR() checks Dan Carpenter
@ 2023-10-19  0:53 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2023-10-19  0:53 UTC (permalink / raw)
  To: Dan Carpenter, Santosh Shilimkar
  Cc: Santosh Shilimkar, Michael Turquette, Mike Turquette,
	linux-kernel, linux-clk, kernel-janitors

Quoting Dan Carpenter (2023-10-05 07:01:57)
> The clk_register_divider() and clk_register_mux() functions returns
> error pointers on error but this code checks for NULL.  Fix that.
> 
> Fixes: b9e0d40c0d83 ("clk: keystone: add Keystone PLL clock driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-19  0:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-05 14:01 [PATCH] clk: keystone: pll: fix a couple NULL vs IS_ERR() checks Dan Carpenter
2023-10-19  0:53 ` Stephen Boyd

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.