summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-03 23:49:26 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-03 23:49:26 +0200
commit57a9d89dc093d86920748fa706fd55f4fcd2399a (patch)
tree9f0e1fe5ffb42713f381739d0140e8ae677375e3 /lib
parentMerge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/ker... (diff)
parentblock: fix blk_stack_limits() regression due to lcm() change (diff)
downloadlinux-57a9d89dc093d86920748fa706fd55f4fcd2399a.tar.xz
linux-57a9d89dc093d86920748fa706fd55f4fcd2399a.zip
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
Pull block layer fix from Jens Axboe: "Just one patch in this pull request, fixing a regression caused by a 'mathematically correct' change to lcm()" * 'for-linus' of git://git.kernel.dk/linux-block: block: fix blk_stack_limits() regression due to lcm() change
Diffstat (limited to 'lib')
-rw-r--r--lib/lcm.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/lcm.c b/lib/lcm.c
index e97dbd51e756..03d7fcb420b5 100644
--- a/lib/lcm.c
+++ b/lib/lcm.c
@@ -12,3 +12,14 @@ unsigned long lcm(unsigned long a, unsigned long b)
return 0;
}
EXPORT_SYMBOL_GPL(lcm);
+
+unsigned long lcm_not_zero(unsigned long a, unsigned long b)
+{
+ unsigned long l = lcm(a, b);
+
+ if (l)
+ return l;
+
+ return (b ? : a);
+}
+EXPORT_SYMBOL_GPL(lcm_not_zero);