Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69c953c8 authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Linus Torvalds
Browse files

lib/lcm.c: lcm(n,0)=lcm(0,n) is 0, not n



Return the mathematically correct answer when an argument is 0.

Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 74a5fef7
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -8,9 +8,7 @@ unsigned long lcm(unsigned long a, unsigned long b)
{
	if (a && b)
		return (a / gcd(a, b)) * b;
	else if (b)
		return b;

	return a;
	else
		return 0;
}
EXPORT_SYMBOL_GPL(lcm);