mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-05 03:44:03 +08:00
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>
This commit is contained in:
parent
f6d480059b
commit
0f2d4a8e27
12
mm/vmalloc.c
12
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))
|
||||
|
Loading…
Reference in New Issue
Block a user