ARM: dma-mapping: silence warning if atomic_pool_size=0

Abort atomic_pool_init if atomic_pool_size=0, silence the following
warning:

[    0.113029] ------------[ cut here ]------------
[    0.113461] WARNING: CPU: 0 PID: 1 at mm/page_alloc.c:3062 __alloc_pages_nodemask+0xc1/0x474()
[    0.114248] Modules linked in:
[    0.114550] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.4.126 #114
[    0.115112] Hardware name: Generic DT based system
[    0.115570] [<c014289d>] (unwind_backtrace) from [<c0140133>] (show_stack+0xb/0xc)
[    0.116269] [<c0140133>] (show_stack) from [<c022bc73>] (dump_stack+0x5b/0x70)
[    0.116935] [<c022bc73>] (dump_stack) from [<c014dfd5>] (warn_slowpath_common+0x55/0x7c)
[    0.117677] [<c014dfd5>] (warn_slowpath_common) from [<c014e055>] (warn_slowpath_null+0xf/0x14)
[    0.118472] [<c014e055>] (warn_slowpath_null) from [<c01a2a39>] (__alloc_pages_nodemask+0xc1/0x474)
[    0.119305] [<c01a2a39>] (__alloc_pages_nodemask) from [<c014544f>] (__dma_alloc_buffer.constprop.6+0x1d/0x7a
)
[    0.120220] [<c014544f>] (__dma_alloc_buffer.constprop.6) from [<c054d165>] (atomic_pool_init+0x31/0xd8)
[    0.121089] [<c054d165>] (atomic_pool_init) from [<c0139725>] (do_one_initcall+0xa1/0x158)
[    0.121847] [<c0139725>] (do_one_initcall) from [<c054aa87>] (kernel_init_freeable+0x10b/0x150)
[    0.122646] [<c054aa87>] (kernel_init_freeable) from [<c040dc4f>] (kernel_init+0x7/0x9c)
[    0.123391] [<c040dc4f>] (kernel_init) from [<c013d541>] (ret_from_fork+0x11/0x30)
[    0.124105] ---[ end trace 1e6e8e7da2c45838 ]---
[    0.124529] DMA: failed to allocate 0 KiB pool for atomic coherent allocation

Change-Id: I3ebeb165d710d44c0493e471461daf82c6902222
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
This commit is contained in:
Tao Huang
2018-05-25 18:34:59 +08:00
parent ba14dd8c0b
commit 234d421421

View File

@@ -338,6 +338,9 @@ static int __init atomic_pool_init(void)
struct page *page;
void *ptr;
if (!atomic_pool_size)
return 0;
atomic_pool = gen_pool_create(PAGE_SHIFT, -1);
if (!atomic_pool)
goto out;