[SPARC]: Check kzalloc() return value in SUN4D irq/iommu init.
authorDavid S. Miller <davem@sunset.davemloft.net>
Fri, 1 Dec 2006 01:11:26 +0000 (17:11 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 10 Dec 2006 10:40:10 +0000 (02:40 -0800)
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/kernel/sun4d_irq.c
arch/sparc/mm/io-unit.c

index b8bd53ab29c531ae457edb01a0dae7e75dfd00d3..cf1b8baa57eafd4c8b9ae3f7e45fdab3564aa6a1 100644 (file)
@@ -546,6 +546,10 @@ void __init sun4d_init_sbi_irq(void)
        for_each_sbus(sbus)
                nsbi++;
        sbus_actions = kzalloc (nsbi * 8 * 4 * sizeof(struct sbus_action), GFP_ATOMIC);
+       if (!sbus_actions) {
+               prom_printf("SUN4D: Cannot allocate sbus_actions, halting.\n");
+               prom_halt();
+       }
        for_each_sbus(sbus) {
 #ifdef CONFIG_SMP      
                extern unsigned char boot_cpu_id;
index 007062022967163142bbac891a3f42246f4df04a..4ccda77d08d6bf7d180036f09d452b2813784676 100644 (file)
@@ -22,6 +22,7 @@
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
 #include <asm/dma.h>
+#include <asm/oplib.h>
 
 /* #define IOUNIT_DEBUG */
 #ifdef IOUNIT_DEBUG
@@ -42,6 +43,10 @@ iounit_init(int sbi_node, int io_node, struct sbus_bus *sbus)
        struct resource r;
 
        iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC);
+       if (!iounit) {
+               prom_printf("SUN4D: Cannot alloc iounit, halting.\n");
+               prom_halt();
+       }
 
        iounit->limit[0] = IOUNIT_BMAP1_START;
        iounit->limit[1] = IOUNIT_BMAP2_START;