diff options
author | Mike Rapoport <rppt@linux.ibm.com> | 2019-03-12 02:30:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-12 13:04:02 -0400 |
commit | c0dbe825a9f11d68725b01b9ed311f7c44ca9166 (patch) | |
tree | d5982f51542b3ef4517d18fcf452af1517808d3f /mm | |
parent | 8a7f97b902f4fb0d94b355b6b3f1fbd7154cafb9 (diff) |
memblock: memblock_alloc_try_nid: don't panic
As all the memblock_alloc*() users are now checking the return value and
panic() in case of error, the panic() call can be removed from the core
memblock allocator, namely memblock_alloc_try_nid().
Link: http://lkml.kernel.org/r/1548057848-15136-21-git-send-email-rppt@linux.ibm.com
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Guan Xuetao <gxt@pku.edu.cn>
Cc: Guo Ren <guoren@kernel.org>
Cc: Guo Ren <ren_guo@c-sky.com> [c-sky]
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Juergen Gross <jgross@suse.com> [Xen]
Cc: Mark Salter <msalter@redhat.com>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Paul Burton <paul.burton@mips.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Rich Felker <dalias@libc.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memblock.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/mm/memblock.c b/mm/memblock.c index 618f94a1eedb..a838c50ca9a8 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -1469,7 +1469,7 @@ void * __init memblock_alloc_try_nid_nopanic( | |||
1469 | } | 1469 | } |
1470 | 1470 | ||
1471 | /** | 1471 | /** |
1472 | * memblock_alloc_try_nid - allocate boot memory block with panicking | 1472 | * memblock_alloc_try_nid - allocate boot memory block |
1473 | * @size: size of memory block to be allocated in bytes | 1473 | * @size: size of memory block to be allocated in bytes |
1474 | * @align: alignment of the region and block's size | 1474 | * @align: alignment of the region and block's size |
1475 | * @min_addr: the lower bound of the memory region from where the allocation | 1475 | * @min_addr: the lower bound of the memory region from where the allocation |
@@ -1479,9 +1479,8 @@ void * __init memblock_alloc_try_nid_nopanic( | |||
1479 | * allocate only from memory limited by memblock.current_limit value | 1479 | * allocate only from memory limited by memblock.current_limit value |
1480 | * @nid: nid of the free area to find, %NUMA_NO_NODE for any node | 1480 | * @nid: nid of the free area to find, %NUMA_NO_NODE for any node |
1481 | * | 1481 | * |
1482 | * Public panicking version of memblock_alloc_try_nid_nopanic() | 1482 | * Public function, provides additional debug information (including caller |
1483 | * which provides debug information (including caller info), if enabled, | 1483 | * info), if enabled. This function zeroes the allocated memory. |
1484 | * and panics if the request can not be satisfied. | ||
1485 | * | 1484 | * |
1486 | * Return: | 1485 | * Return: |
1487 | * Virtual address of allocated memory block on success, NULL on failure. | 1486 | * Virtual address of allocated memory block on success, NULL on failure. |
@@ -1498,14 +1497,10 @@ void * __init memblock_alloc_try_nid( | |||
1498 | &max_addr, (void *)_RET_IP_); | 1497 | &max_addr, (void *)_RET_IP_); |
1499 | ptr = memblock_alloc_internal(size, align, | 1498 | ptr = memblock_alloc_internal(size, align, |
1500 | min_addr, max_addr, nid); | 1499 | min_addr, max_addr, nid); |
1501 | if (ptr) { | 1500 | if (ptr) |
1502 | memset(ptr, 0, size); | 1501 | memset(ptr, 0, size); |
1503 | return ptr; | ||
1504 | } | ||
1505 | 1502 | ||
1506 | panic("%s: Failed to allocate %llu bytes align=0x%llx nid=%d from=%pa max_addr=%pa\n", | 1503 | return ptr; |
1507 | __func__, (u64)size, (u64)align, nid, &min_addr, &max_addr); | ||
1508 | return NULL; | ||
1509 | } | 1504 | } |
1510 | 1505 | ||
1511 | /** | 1506 | /** |