]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mm, vmalloc: use clamp() to simplify code
authorZhang Yanfei <zhangyanfei@cn.fujitsu.com>
Wed, 3 Jul 2013 22:04:50 +0000 (15:04 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 Jul 2013 23:07:40 +0000 (16:07 -0700)
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>
mm/vmalloc.c

index bd60bffd9aefc08bee5c66a8c7e0b953a051d498..91a10472a39a833b29ae0be1faeb6c30c72c0160 100644 (file)
@@ -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))