[PATCH] arm: Add clk_get_rate input parameter null check
From: Wang Qing
Date: Thu Nov 05 2020 - 20:52:23 EST
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@xxxxxxxx>
---
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