diff options
author | Zhang Yanfei <zhangyanfei@cn.fujitsu.com> | 2013-07-03 15:04:50 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 16:07:40 -0700 |
commit | 0f2d4a8e27108ad3b2555396b06392be590fe287 (patch) | |
tree | 3b54150b97679b2c2ae43927910c55b429d7cd65 /mm | |
parent | f6d480059bedaf4feb06466c770f5fcace9eca31 (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')
-rw-r--r-- | mm/vmalloc.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index bd60bffd9ae..91a10472a39 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1330,16 +1330,8 @@ static struct vm_struct *__get_vm_area_node(unsigned long size, struct vm_struct *area; BUG_ON(in_interrupt()); - if (flags & VM_IOREMAP) { - int bit = fls(size); - - if (bit > IOREMAP_MAX_ORDER) - bit = IOREMAP_MAX_ORDER; - else if (bit < PAGE_SHIFT) - bit = PAGE_SHIFT; - - align = 1ul << bit; - } + if (flags & VM_IOREMAP) + align = 1ul << clamp(fls(size), PAGE_SHIFT, IOREMAP_MAX_ORDER); size = PAGE_ALIGN(size); if (unlikely(!size)) |