aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
authorZhang Yanfei <zhangyanfei@cn.fujitsu.com>2013-07-03 18:04:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 19:07:40 -0400
commit0f2d4a8e27108ad3b2555396b06392be590fe287 (patch)
tree3b54150b97679b2c2ae43927910c55b429d7cd65 /mm/vmalloc.c
parentf6d480059bedaf4feb06466c770f5fcace9eca31 (diff)
mm, vmalloc: use clamp() to simplify code
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index bd60bffd9aef..91a10472a39a 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1330,16 +1330,8 @@ static struct vm_struct *__get_vm_area_node(unsigned long size,
1330 struct vm_struct *area; 1330 struct vm_struct *area;
1331 1331
1332 BUG_ON(in_interrupt()); 1332 BUG_ON(in_interrupt());
1333 if (flags & VM_IOREMAP) { 1333 if (flags & VM_IOREMAP)
1334 int bit = fls(size); 1334 align = 1ul << clamp(fls(size), PAGE_SHIFT, IOREMAP_MAX_ORDER);
1335
1336 if (bit > IOREMAP_MAX_ORDER)
1337 bit = IOREMAP_MAX_ORDER;
1338 else if (bit < PAGE_SHIFT)
1339 bit = PAGE_SHIFT;
1340
1341 align = 1ul << bit;
1342 }
1343 1335
1344 size = PAGE_ALIGN(size); 1336 size = PAGE_ALIGN(size);
1345 if (unlikely(!size)) 1337 if (unlikely(!size))