[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170718101730.2541-3-jonas.gorski@gmail.com>
Date: Tue, 18 Jul 2017 12:17:23 +0200
From: Jonas Gorski <jonas.gorski@...il.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Eric Miao <eric.y.miao@...il.com>,
Haojian Zhuang <haojian.zhuang@...il.com>,
Russell King <linux@...linux.org.uk>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH 2/9] ARM: mmp: allow NULL clock for clk_get_rate
Make the behaviour of clk_get_rate consistent with common clk's
clk_get_rate by accepting NULL clocks as parameter. Some device
drivers rely on this, and will cause an OOPS otherwise.
Fixes: 49cbe78637eb ("[ARM] pxa: add base support for Marvell's PXA168 processor line")
Cc: Eric Miao <eric.y.miao@...il.com>
Cc: Haojian Zhuang <haojian.zhuang@...il.com>
Cc: Russell King <linux@...linux.org.uk>
Cc: linux-arm-kernel@...ts.infradead.org
Cc: linux-kernel@...r.kernel.org
Reported-by: Mathias Kresin <dev@...sin.me>
Signed-off-by: Jonas Gorski <jonas.gorski@...il.com>
---
arch/arm/mach-mmp/clock.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-mmp/clock.c b/arch/arm/mach-mmp/clock.c
index 28fe64c6e2f5..bdfb113431ec 100644
--- a/arch/arm/mach-mmp/clock.c
+++ b/arch/arm/mach-mmp/clock.c
@@ -83,7 +83,9 @@ unsigned long clk_get_rate(struct clk *clk)
{
unsigned long rate;
- if (clk->ops->getrate)
+ if (!clk)
+ rate = 0;
+ else if (clk->ops->getrate)
rate = clk->ops->getrate(clk);
else
rate = clk->rate;
--
2.11.0
Powered by blists - more mailing lists