linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm: Add clk_get_rate input parameter null check
@ 2020-11-06  1:46 Wang Qing
  2020-11-06  5:57 ` Alexander Sverdlin
  0 siblings, 1 reply; 2+ messages in thread
From: Wang Qing @ 2020-11-06  1:46 UTC (permalink / raw)
  To: Hartley Sweeten, Alexander Sverdlin, Russell King,
	linux-arm-kernel, linux-kernel
  Cc: Wang Qing

The input parameter of clk_get_rate() is checked with IS_ERR(),
so here we need to check null on clk.

Signed-off-by: Wang Qing <wangqing@vivo.com>
---
 arch/arm/mach-ep93xx/clock.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index 2810eb5..4313b2f
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -321,6 +321,9 @@ static unsigned long get_uart_rate(struct clk *clk)
 
 unsigned long clk_get_rate(struct clk *clk)
 {
+	if (!clk)
+		return 0;
+
 	if (clk->get_rate)
 		return clk->get_rate(clk);
 
-- 
2.7.4


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

* Re: [PATCH] arm: Add clk_get_rate input parameter null check
  2020-11-06  1:46 [PATCH] arm: Add clk_get_rate input parameter null check Wang Qing
@ 2020-11-06  5:57 ` Alexander Sverdlin
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Sverdlin @ 2020-11-06  5:57 UTC (permalink / raw)
  To: Wang Qing, Hartley Sweeten, Russell King, linux-arm-kernel, linux-kernel

Hello Wang!

On Fri, 2020-11-06 at 09:46 +0800, Wang Qing wrote:
> The input parameter of clk_get_rate() is checked with IS_ERR(),
> so here we need to check null on clk.

Thank you for the patch!

> Signed-off-by: Wang Qing <wangqing@vivo.com>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>

> ---
>  arch/arm/mach-ep93xx/clock.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-
> ep93xx/clock.c
> index 2810eb5..4313b2f
> --- a/arch/arm/mach-ep93xx/clock.c
> +++ b/arch/arm/mach-ep93xx/clock.c
> @@ -321,6 +321,9 @@ static unsigned long get_uart_rate(struct clk
> *clk)
>  
>  unsigned long clk_get_rate(struct clk *clk)
>  {
> +	if (!clk)
> +		return 0;
> +
>  	if (clk->get_rate)
>  		return clk->get_rate(clk);
>  
-- 
Alexander Sverdlin.



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

end of thread, other threads:[~2020-11-06  5:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06  1:46 [PATCH] arm: Add clk_get_rate input parameter null check Wang Qing
2020-11-06  5:57 ` Alexander Sverdlin

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