diff mbox series

x86/platform/olpc: Fix the error handling of memblock_alloc failure

Message ID 20200121232818.28018-1-pakki001@umn.edu (mailing list archive)
State Deferred, archived
Headers show
Series x86/platform/olpc: Fix the error handling of memblock_alloc failure | expand

Commit Message

Aditya Pakki Jan. 21, 2020, 11:28 p.m. UTC
In case of an error in memblock_alloc, the code calls both panic and
BUG_ON. Revert the error handling to BUG_ON.

Fixes: 8a7f97b902f4 (add checks for the return value of memblock_alloc*())
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 arch/x86/platform/olpc/olpc_dt.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Lubomir Rintel Jan. 22, 2020, 7:42 a.m. UTC | #1
On Tue, Jan 21, 2020 at 05:28:16PM -0600, Aditya Pakki wrote:
> In case of an error in memblock_alloc, the code calls both panic and
> BUG_ON. Revert the error handling to BUG_ON.
> 
> Fixes: 8a7f97b902f4 (add checks for the return value of memblock_alloc*())
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>

Reviewed-by: Lubomir Rintel <lkundrak@v3.sk>

Thank you
Lubo

> ---
>  arch/x86/platform/olpc/olpc_dt.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/arch/x86/platform/olpc/olpc_dt.c b/arch/x86/platform/olpc/olpc_dt.c
> index 26d1f6693789..92d5ce1232ab 100644
> --- a/arch/x86/platform/olpc/olpc_dt.c
> +++ b/arch/x86/platform/olpc/olpc_dt.c
> @@ -137,9 +137,6 @@ void * __init prom_early_alloc(unsigned long size)
>  		 * wasted bootmem) and hand off chunks of it to callers.
>  		 */
>  		res = memblock_alloc(chunk_size, SMP_CACHE_BYTES);
> -		if (!res)
> -			panic("%s: Failed to allocate %zu bytes\n", __func__,
> -			      chunk_size);
>  		BUG_ON(!res);
>  		prom_early_allocated += chunk_size;
>  		memset(res, 0, chunk_size);
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/arch/x86/platform/olpc/olpc_dt.c b/arch/x86/platform/olpc/olpc_dt.c
index 26d1f6693789..92d5ce1232ab 100644
--- a/arch/x86/platform/olpc/olpc_dt.c
+++ b/arch/x86/platform/olpc/olpc_dt.c
@@ -137,9 +137,6 @@  void * __init prom_early_alloc(unsigned long size)
 		 * wasted bootmem) and hand off chunks of it to callers.
 		 */
 		res = memblock_alloc(chunk_size, SMP_CACHE_BYTES);
-		if (!res)
-			panic("%s: Failed to allocate %zu bytes\n", __func__,
-			      chunk_size);
 		BUG_ON(!res);
 		prom_early_allocated += chunk_size;
 		memset(res, 0, chunk_size);