[PATCH 2.5.66] Janitor: misc_register() can fail, even in drivers/char/upd4990.c

From: Stephan Maciej (stephanm@muc.de)
Date: Mon Mar 31 2003 - 09:15:38 EST


--- linux-2.5.66/drivers/char/upd4990a.c~unmodified 2003-03-31 15:42:15.000000000 +0200
+++ linux-2.5.66/drivers/char/upd4990a.c 2003-03-31 16:05:15.000000000 +0200
@@ -343,19 +343,28 @@
 
 static int __init rtc_init(void)
 {
+ int err = 0;
+
         if (!request_region(UPD4990A_IO, 1, "rtc")) {
                 printk(KERN_ERR "upd4990a: could not acquire I/O port %#x\n",
                         UPD4990A_IO);
                 return -EBUSY;
         }
 
+ err = misc_register(&rtc_dev);
+ if (err) {
+ printk(KERN_ERR "upd4990a: can't misc_register() on minor=%d\n",
+ RTC_MINOR);
+ release_region(UPD4990A_IO, 1);
+ return err;
+ }
+
 #if 0
         printk(KERN_INFO "\xB6\xDA\xDD\xC0\xDE \xC4\xDE\xB9\xB2 Driver\n"); /* Calender Clock Driver */
 #else
         printk(KERN_INFO
                "Real Time Clock driver for NEC PC-9800 v" RTC98_VERSION "\n");
 #endif
- misc_register(&rtc_dev);
         create_proc_read_entry("driver/rtc", 0, NULL, rtc_read_proc, NULL);
 
         init_timer(&rtc_uie_timer);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Mar 31 2003 - 22:00:36 EST