Skip to contentSkip to conversation

pc keyboard driver minor cleanup

PATCH New [email protected] 1 participant 1 message Jun 13, 2001

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pc keyboard driver minor cleanup

Hi,

added misc_register() return value checking and removed panic() in case of kmalloc failure (IMHO it's possible to live without PS/2 mouse :)

Best regards.

Signature · 2 lines
Andrey Panin            | Embedded systems software engineer
[email protected]        | PGP key: http://www.orbita1.ru/~pazke/AndreyPanin.asc
linux/drivers/char/pc_keyb.c renamed from linux.vanilla/drivers/char/pc_keyb.c +10 -3
diff -u -X /usr/dontdiff /linux.vanilla/drivers/char/pc_keyb.c /linux/drivers/char/pc_keyb.c
@@ -1011,13 +1011,20 @@
 
 static int __init psaux_init(void)
 {
+	int retval;
+
 	if (!detect_auxiliary_port())
 		return -EIO;
 
-	misc_register(&psaux_mouse);
+	if ((retval = misc_register(&psaux_mouse)))
+		return retval;
+
 	queue = (struct aux_queue *) kmalloc(sizeof(*queue), GFP_KERNEL);
-	if (queue == NULL)
-		panic("psaux_init(): out of memory");
+	if (queue == NULL) {
+		printk(KERN_ERR "psaux_init(): out of memory\n");
+		misc_deregister(&psaux_mouse);
+		return -ENOMEM;
+	}
 	memset(queue, 0, sizeof(*queue));
 	queue->head = queue->tail = 0;
 	init_waitqueue_head(&queue->proc_list);