Commit f93e2a10 authored by Xiaoke Wang's avatar Xiaoke Wang Committed by Thomas Bogendoerfer
Browse files

mips: sgi-ip22: add a check for the return of kzalloc()



kzalloc() is a memory allocation function which can return NULL when
some internal memory errors happen. So it is better to check it to
prevent potential wrong memory access.

Signed-off-by: default avatarXiaoke Wang <xkernel.wang@foxmail.com>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
parent f8f9f21c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -363,6 +363,8 @@ static void ip22_check_gio(int slotno, unsigned long addr, int irq)
		printk(KERN_INFO "GIO: slot %d : %s (id %x)\n",
		       slotno, name, id);
		gio_dev = kzalloc(sizeof *gio_dev, GFP_KERNEL);
		if (!gio_dev)
			return;
		gio_dev->name = name;
		gio_dev->slotno = slotno;
		gio_dev->id.id = id;