linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: mxs: Remove unneeded NULL pointer check
@ 2012-11-21 21:33 Fabio Estevam
  2012-12-11 10:33 ` Fabio Estevam
  0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2012-11-21 21:33 UTC (permalink / raw)
  To: shawn.guo; +Cc: mturquette, linux-kernel, Fabio Estevam

From: Fabio Estevam <fabio.estevam@freescale.com>

mxs platform has been converted to device tree.

There is no need to check if np is NULL after doing:

np = of_find_compatible_node(NULL, NULL, "fsl,imx[23/28]-clkctrl");

,as it will always be non-NULL.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/clk/mxs/clk-imx23.c |    8 +++-----
 drivers/clk/mxs/clk-imx28.c |    8 +++-----
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c
index f00dffb..02c90d4 100644
--- a/drivers/clk/mxs/clk-imx23.c
+++ b/drivers/clk/mxs/clk-imx23.c
@@ -154,11 +154,9 @@ int __init mx23_clocks_init(void)
 		}
 
 	np = of_find_compatible_node(NULL, NULL, "fsl,imx23-clkctrl");
-	if (np) {
-		clk_data.clks = clks;
-		clk_data.clk_num = ARRAY_SIZE(clks);
-		of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
-	}
+	clk_data.clks = clks;
+	clk_data.clk_num = ARRAY_SIZE(clks);
+	of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
 
 	clk_register_clkdev(clks[clk32k], NULL, "timrot");
 
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index 42978f1b..1ba6c0f 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -232,11 +232,9 @@ int __init mx28_clocks_init(void)
 		}
 
 	np = of_find_compatible_node(NULL, NULL, "fsl,imx28-clkctrl");
-	if (np) {
-		clk_data.clks = clks;
-		clk_data.clk_num = ARRAY_SIZE(clks);
-		of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
-	}
+	clk_data.clks = clks;
+	clk_data.clk_num = ARRAY_SIZE(clks);
+	of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
 
 	clk_register_clkdev(clks[clk32k], NULL, "timrot");
 	clk_register_clkdev(clks[enet_out], NULL, "enet_out");
-- 
1.7.9.5


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

* Re: [PATCH] clk: mxs: Remove unneeded NULL pointer check
  2012-11-21 21:33 [PATCH] clk: mxs: Remove unneeded NULL pointer check Fabio Estevam
@ 2012-12-11 10:33 ` Fabio Estevam
  2012-12-11 13:20   ` Shawn Guo
  0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2012-12-11 10:33 UTC (permalink / raw)
  To: shawn.guo; +Cc: mturquette, linux-kernel, Fabio Estevam

Shawn/Mike,

On Wed, Nov 21, 2012 at 7:33 PM, Fabio Estevam <festevam@gmail.com> wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> mxs platform has been converted to device tree.
>
> There is no need to check if np is NULL after doing:
>
> np = of_find_compatible_node(NULL, NULL, "fsl,imx[23/28]-clkctrl");
>
> ,as it will always be non-NULL.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Does this patch look good?

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

* Re: [PATCH] clk: mxs: Remove unneeded NULL pointer check
  2012-12-11 10:33 ` Fabio Estevam
@ 2012-12-11 13:20   ` Shawn Guo
  0 siblings, 0 replies; 3+ messages in thread
From: Shawn Guo @ 2012-12-11 13:20 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: mturquette, linux-kernel, Fabio Estevam

On Tue, Dec 11, 2012 at 08:33:34AM -0200, Fabio Estevam wrote:
> Shawn/Mike,
> 
> On Wed, Nov 21, 2012 at 7:33 PM, Fabio Estevam <festevam@gmail.com> wrote:
> > From: Fabio Estevam <fabio.estevam@freescale.com>
> >
> > mxs platform has been converted to device tree.
> >
> > There is no need to check if np is NULL after doing:
> >
> > np = of_find_compatible_node(NULL, NULL, "fsl,imx[23/28]-clkctrl");
> >
> > ,as it will always be non-NULL.
> >
> > Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> 
> Does this patch look good?

Hmm, technically the check is still valid, as np can be NULL if
the clkctrl node with correct compatible string is not present.

Shawn


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

end of thread, other threads:[~2012-12-11 13:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-21 21:33 [PATCH] clk: mxs: Remove unneeded NULL pointer check Fabio Estevam
2012-12-11 10:33 ` Fabio Estevam
2012-12-11 13:20   ` Shawn Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).