Skip to contentSkip to conversation

x86: OLPC: have prom_early_alloc BUG rather than return NULL

PATCH In review Andres Salomon 2 participants 2 messages Feb 25, 2011 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: OLPC: have prom_early_alloc BUG rather than return NULL

..similar to what sparc's prom_early_alloc does.

---
 arch/x86/platform/olpc/olpc_dt.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
arch/x86/platform/olpc/olpc_dt.c +1 -2
index dab8746..044bda5 100644
@@ -140,8 +140,7 @@ void * __init prom_early_alloc(unsigned long size)
 		 * wasted bootmem) and hand off chunks of it to callers.
 		 */
 		res = alloc_bootmem(chunk_size);
-		if (!res)
-			return NULL;
+		BUG_ON(!res);
 		prom_early_allocated += chunk_size;
 		memset(res, 0, chunk_size);
 		free_mem = chunk_size;
Signature · 1 line
1.7.2.3
#1 lore raw
Quoted 4 lines · Andres Salomon

..similar to what sparc's prom_early_alloc does.

What the hey, I've picked this up since it makes the other patch simpler. I'll push the two patches to linux-next tomorrow and ask Linus to pull in a few days.

g.

Quoted 22 lines

---
 arch/x86/platform/olpc/olpc_dt.c |    3 +--

 1 files changed, 1 insertions(+), 2 deletions(-)
arch/x86/platform/olpc/olpc_dt.c +1 -3
index dab8746..044bda5 100644
@@ -140,8 +140,7 @@ void * __init prom_early_alloc(unsigned long size)
                 * wasted bootmem) and hand off chunks of it to callers.
                 */
                res = alloc_bootmem(chunk_size);
-               if (!res)
-                       return NULL;
+               BUG_ON(!res);
                prom_early_allocated += chunk_size;
                memset(res, 0, chunk_size);
                free_mem = chunk_size;
--

1.7.2.3

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.