diff options
Diffstat (limited to 'lib/gcd.c')
-rw-r--r-- | lib/gcd.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/gcd.c b/lib/gcd.c index f879033d9822..3657f129d7b8 100644 --- 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; |