From: Zhang Yanfei Date: Wed, 3 Jul 2013 22:04:50 +0000 (-0700) Subject: mm, vmalloc: use clamp() to simplify code X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0f2d4a8e27108ad3b2555396b06392be590fe287;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git mm, vmalloc: use clamp() to simplify code Signed-off-by: Zhang Yanfei Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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, 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))