[PATCH 3.16 054/133] m68k: allow NULL clock for clk_get_rate

From: Ben Hutchings
Date: Tue Nov 21 2017 - 21:26:49 EST


3.16.51-rc1 review patch. If anyone has any objections, please let me know.

------------------

From: Jonas Gorski <jonas.gorski@xxxxxxxxx>

commit 94b282267c2f3af725b154c91275ed374c1f11de upstream.

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: facdf0ed4f59 ("m68knommu: introduce basic clk infrastructure")
Cc: Greg Ungerer <gerg@xxxxxxxxxxxxxx>
Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Cc: linux-m68k@xxxxxxxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Reported-by: Mathias Kresin <dev@xxxxxxxxx>
Signed-off-by: Jonas Gorski <jonas.gorski@xxxxxxxxx>
Signed-off-by: Greg Ungerer <gerg@xxxxxxxxxxxxxx>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
arch/m68k/platform/coldfire/clk.c | 3 +++
1 file changed, 3 insertions(+)

--- a/arch/m68k/platform/coldfire/clk.c
+++ b/arch/m68k/platform/coldfire/clk.c
@@ -117,6 +117,9 @@ EXPORT_SYMBOL(clk_put);

unsigned long clk_get_rate(struct clk *clk)
{
+ if (!clk)
+ return 0;
+
return clk->rate;
}
EXPORT_SYMBOL(clk_get_rate);