patch-2.4.20 linux-2.4.20/drivers/acorn/char/mouse_ps2.c

Next file: linux-2.4.20/drivers/acorn/char/pcf8583.c
Previous file: linux-2.4.20/drivers/acorn/block/fd1772.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.19/drivers/acorn/char/mouse_ps2.c linux-2.4.20/drivers/acorn/char/mouse_ps2.c
@@ -273,9 +273,15 @@
 	iomd_writeb(0, IOMD_MSECTL);
 	iomd_writeb(8, IOMD_MSECTL);
   
-	if (misc_register(&psaux_mouse))
-		return -ENODEV;
 	queue = (struct aux_queue *) kmalloc(sizeof(*queue), GFP_KERNEL);
+	if (queue == NULL)
+		return -ENOMEM;
+
+	if (misc_register(&psaux_mouse)) {
+		kfree(queue);
+		return -ENODEV;
+	}
+
 	memset(queue, 0, sizeof(*queue));
 	queue->head = queue->tail = 0;
 	init_waitqueue_head(&queue->proc_list);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)