clk: defer clk_gets on orphan clocks
[firefly-linux-kernel-4.4.55.git] / lib / gcd.c
index f879033d98229450a7a88d891c16319cc213f134..3657f129d7b8c5db0bee11a94a97d5d4bf251b52 100644 (file)
--- a/lib/gcd.c
+++ b/lib/gcd.c
@@ -1,6 +1,6 @@
 #include <linux/kernel.h>
 #include <linux/gcd.h>
-#include <linux/module.h>
+#include <linux/export.h>
 
 /* Greatest common divisor */
 unsigned long gcd(unsigned long a, unsigned long b)
@@ -9,6 +9,9 @@ unsigned long gcd(unsigned long a, unsigned long b)
 
        if (a < b)
                swap(a, b);
+
+       if (!b)
+               return a;
        while ((r = a % b) != 0) {
                a = b;
                b = r;