Commit 0f2d4a8e authored by Zhang Yanfei's avatar Zhang Yanfei Committed by Linus Torvalds

mm, vmalloc: use clamp() to simplify code

Signed-off-by: default avatarZhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f6d48005
...@@ -1330,16 +1330,8 @@ static struct vm_struct *__get_vm_area_node(unsigned long size, ...@@ -1330,16 +1330,8 @@ static struct vm_struct *__get_vm_area_node(unsigned long size,
struct vm_struct *area; struct vm_struct *area;
BUG_ON(in_interrupt()); BUG_ON(in_interrupt());
if (flags & VM_IOREMAP) { if (flags & VM_IOREMAP)
int bit = fls(size); align = 1ul << clamp(fls(size), PAGE_SHIFT, IOREMAP_MAX_ORDER);
if (bit > IOREMAP_MAX_ORDER)
bit = IOREMAP_MAX_ORDER;
else if (bit < PAGE_SHIFT)
bit = PAGE_SHIFT;
align = 1ul << bit;
}
size = PAGE_ALIGN(size); size = PAGE_ALIGN(size);
if (unlikely(!size)) if (unlikely(!size))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment