提交 d4accd60 编写于 作者: D David S. Miller

[SPARC]: Check kzalloc() return value in SUN4D irq/iommu init.

Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 c80892d1
...@@ -546,6 +546,10 @@ void __init sun4d_init_sbi_irq(void) ...@@ -546,6 +546,10 @@ void __init sun4d_init_sbi_irq(void)
for_each_sbus(sbus) for_each_sbus(sbus)
nsbi++; nsbi++;
sbus_actions = kzalloc (nsbi * 8 * 4 * sizeof(struct sbus_action), GFP_ATOMIC); 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) { for_each_sbus(sbus) {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
extern unsigned char boot_cpu_id; extern unsigned char boot_cpu_id;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
#include <asm/dma.h> #include <asm/dma.h>
#include <asm/oplib.h>
/* #define IOUNIT_DEBUG */ /* #define IOUNIT_DEBUG */
#ifdef IOUNIT_DEBUG #ifdef IOUNIT_DEBUG
...@@ -42,6 +43,10 @@ iounit_init(int sbi_node, int io_node, struct sbus_bus *sbus) ...@@ -42,6 +43,10 @@ iounit_init(int sbi_node, int io_node, struct sbus_bus *sbus)
struct resource r; struct resource r;
iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC); 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[0] = IOUNIT_BMAP1_START;
iounit->limit[1] = IOUNIT_BMAP2_START; iounit->limit[1] = IOUNIT_BMAP2_START;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册