From 234d4214216483b28eb9c2df07944c3adb3cb70b Mon Sep 17 00:00:00 2001 From: Tao Huang Date: Fri, 25 May 2018 18:34:59 +0800 Subject: [PATCH] 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] [] (unwind_backtrace) from [] (show_stack+0xb/0xc) [ 0.116269] [] (show_stack) from [] (dump_stack+0x5b/0x70) [ 0.116935] [] (dump_stack) from [] (warn_slowpath_common+0x55/0x7c) [ 0.117677] [] (warn_slowpath_common) from [] (warn_slowpath_null+0xf/0x14) [ 0.118472] [] (warn_slowpath_null) from [] (__alloc_pages_nodemask+0xc1/0x474) [ 0.119305] [] (__alloc_pages_nodemask) from [] (__dma_alloc_buffer.constprop.6+0x1d/0x7a ) [ 0.120220] [] (__dma_alloc_buffer.constprop.6) from [] (atomic_pool_init+0x31/0xd8) [ 0.121089] [] (atomic_pool_init) from [] (do_one_initcall+0xa1/0x158) [ 0.121847] [] (do_one_initcall) from [] (kernel_init_freeable+0x10b/0x150) [ 0.122646] [] (kernel_init_freeable) from [] (kernel_init+0x7/0x9c) [ 0.123391] [] (kernel_init) from [] (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 --- arch/arm/mm/dma-mapping.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index d539dee3c78d..ea4b5ef7f287 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -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;