patch-2.4.5 linux/drivers/char/pcwd.c

Next file: linux/drivers/char/pcxx.c
Previous file: linux/drivers/char/pc110pad.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.4/linux/drivers/char/pcwd.c linux/drivers/char/pcwd.c
@@ -247,7 +247,7 @@
 
 	switch(cmd) {
 	default:
-		return -ENOIOCTLCMD;
+		return -ENOTTY;
 
 	case WDIOC_GETSUPPORT:
 		i = copy_to_user((void*)arg, &ident, sizeof(ident));
@@ -506,6 +506,8 @@
 	char *ret;
 
 	ret = kmalloc(6, GFP_KERNEL);
+	if(ret == NULL)
+		return NULL;
 
 	while((count < 3) && (!found)) {
 		outb_p(0x80, current_readport + 2);
@@ -527,10 +529,8 @@
 		ten = send_command(0x82);
 		hund = send_command(0x83);
 		minor = send_command(0x84);
-	}
-
-	if (found)
 		sprintf(ret, "%c.%c%c%c", one, ten, hund, minor);
+	}
 	else
 		sprintf(ret, "ERROR");
 
@@ -642,12 +642,12 @@
 
 static void __exit pcwatchdog_exit(void)
 {
+	misc_deregister(&pcwd_miscdev);
 	/*  Disable the board  */
 	if (revision == PCWD_REVISION_C) {
 		outb_p(0xA5, current_readport + 3);
 		outb_p(0xA5, current_readport + 3);
 	}
-	misc_deregister(&pcwd_miscdev);
 	if (supports_temp)
 		misc_deregister(&temp_miscdev);
 

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