sparc: add checks for the return value of memblock_alloc*()
[linux-2.6-microblaze.git] / arch / sparc / mm / srmmu.c
index b609362..aaebbc0 100644 (file)
@@ -303,13 +303,19 @@ static void __init srmmu_nocache_init(void)
 
        bitmap_bits = srmmu_nocache_size >> SRMMU_NOCACHE_BITMAP_SHIFT;
 
-       srmmu_nocache_pool = memblock_alloc_from(srmmu_nocache_size,
-                                                SRMMU_NOCACHE_ALIGN_MAX, 0UL);
+       srmmu_nocache_pool = memblock_alloc(srmmu_nocache_size,
+                                           SRMMU_NOCACHE_ALIGN_MAX);
+       if (!srmmu_nocache_pool)
+               panic("%s: Failed to allocate %lu bytes align=0x%x\n",
+                     __func__, srmmu_nocache_size, SRMMU_NOCACHE_ALIGN_MAX);
        memset(srmmu_nocache_pool, 0, srmmu_nocache_size);
 
        srmmu_nocache_bitmap =
-               memblock_alloc_from(BITS_TO_LONGS(bitmap_bits) * sizeof(long),
-                                   SMP_CACHE_BYTES, 0UL);
+               memblock_alloc(BITS_TO_LONGS(bitmap_bits) * sizeof(long),
+                              SMP_CACHE_BYTES);
+       if (!srmmu_nocache_bitmap)
+               panic("%s: Failed to allocate %zu bytes\n", __func__,
+                     BITS_TO_LONGS(bitmap_bits) * sizeof(long));
        bit_map_init(&srmmu_nocache_map, srmmu_nocache_bitmap, bitmap_bits);
 
        srmmu_swapper_pg_dir = __srmmu_get_nocache(SRMMU_PGD_TABLE_SIZE, SRMMU_PGD_TABLE_SIZE);
@@ -467,7 +473,9 @@ static void __init sparc_context_init(int numctx)
        unsigned long size;
 
        size = numctx * sizeof(struct ctx_list);
-       ctx_list_pool = memblock_alloc_from(size, SMP_CACHE_BYTES, 0UL);
+       ctx_list_pool = memblock_alloc(size, SMP_CACHE_BYTES);
+       if (!ctx_list_pool)
+               panic("%s: Failed to allocate %lu bytes\n", __func__, size);
 
        for (ctx = 0; ctx < numctx; ctx++) {
                struct ctx_list *clist;