linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] clk: imx: remove unnecessary NULL check of clk
@ 2022-06-30 14:13 Yang Yingliang
  2022-07-30  1:00 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2022-06-30 14:13 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linux-clk; +Cc: abelvesa, shawnguo

It has NULL check in clk_prepare_enable(), so it no need
to check the clk before calling it.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/clk/imx/clk.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c
index 5582f18dd632..1c5d5b957c96 100644
--- a/drivers/clk/imx/clk.c
+++ b/drivers/clk/imx/clk.c
@@ -189,9 +189,7 @@ void imx_register_uart_clocks(unsigned int clk_count)
 			if (IS_ERR(imx_uart_clocks[imx_enabled_uart_clocks]))
 				return;
 
-			/* Only enable the clock if it's not NULL */
-			if (imx_uart_clocks[imx_enabled_uart_clocks])
-				clk_prepare_enable(imx_uart_clocks[imx_enabled_uart_clocks++]);
+			clk_prepare_enable(imx_uart_clocks[imx_enabled_uart_clocks++]);
 		}
 	}
 #endif
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH -next] clk: imx: remove unnecessary NULL check of clk
  2022-06-30 14:13 [PATCH -next] clk: imx: remove unnecessary NULL check of clk Yang Yingliang
@ 2022-07-30  1:00 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2022-07-30  1:00 UTC (permalink / raw)
  To: Yang Yingliang, linux-arm-kernel, linux-clk, linux-kernel
  Cc: abelvesa, shawnguo

Quoting Yang Yingliang (2022-06-30 07:13:08)
> It has NULL check in clk_prepare_enable(), so it no need
> to check the clk before calling it.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/clk/imx/clk.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c
> index 5582f18dd632..1c5d5b957c96 100644
> --- a/drivers/clk/imx/clk.c
> +++ b/drivers/clk/imx/clk.c
> @@ -189,9 +189,7 @@ void imx_register_uart_clocks(unsigned int clk_count)
>                         if (IS_ERR(imx_uart_clocks[imx_enabled_uart_clocks]))
>                                 return;
>  
> -                       /* Only enable the clock if it's not NULL */
> -                       if (imx_uart_clocks[imx_enabled_uart_clocks])
> -                               clk_prepare_enable(imx_uart_clocks[imx_enabled_uart_clocks++]);
> +                       clk_prepare_enable(imx_uart_clocks[imx_enabled_uart_clocks++]);

Nak

The ++ operator has side-effects, which wasn't the case before this
patch.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-07-30  1:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-30 14:13 [PATCH -next] clk: imx: remove unnecessary NULL check of clk Yang Yingliang
2022-07-30  1:00 ` Stephen Boyd

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).