diff options
author | Jan Beulich <jbeulich@novell.com> | 2006-12-13 03:35:04 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-13 12:05:52 -0500 |
commit | f3e92d355e1251fb6d1a15508f2a5448d2354727 (patch) | |
tree | ccfd9584eaec47ea09d37308c8651fa66f56c65e /drivers/char/rtc.c | |
parent | e8c5c045d790e7018c56f1a998a2d240b732ea3c (diff) |
[PATCH] rtc: fx error case
Ensure RTC driver doesn't use its timer when it doesn't get to set it up
(as it cannot currently prevent other of its functions to be called from
outside when not built as a module - probably this should also be
addressed).
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/rtc.c')
-rw-r--r-- | drivers/char/rtc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index 66a7385bc34a..2eb53bea1866 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -958,6 +958,7 @@ static int __init rtc_init(void) | |||
958 | } | 958 | } |
959 | } | 959 | } |
960 | #endif | 960 | #endif |
961 | rtc_has_irq = 0; | ||
961 | printk(KERN_ERR "rtc_init: no PC rtc found\n"); | 962 | printk(KERN_ERR "rtc_init: no PC rtc found\n"); |
962 | return -EIO; | 963 | return -EIO; |
963 | 964 | ||
@@ -972,6 +973,7 @@ found: | |||
972 | * PCI Slot 2 INTA# (and some INTx# in Slot 1). | 973 | * PCI Slot 2 INTA# (and some INTx# in Slot 1). |
973 | */ | 974 | */ |
974 | if (request_irq(rtc_irq, rtc_interrupt, IRQF_SHARED, "rtc", (void *)&rtc_port)) { | 975 | if (request_irq(rtc_irq, rtc_interrupt, IRQF_SHARED, "rtc", (void *)&rtc_port)) { |
976 | rtc_has_irq = 0; | ||
975 | printk(KERN_ERR "rtc: cannot register IRQ %d\n", rtc_irq); | 977 | printk(KERN_ERR "rtc: cannot register IRQ %d\n", rtc_irq); |
976 | return -EIO; | 978 | return -EIO; |
977 | } | 979 | } |
@@ -982,6 +984,9 @@ no_irq: | |||
982 | else | 984 | else |
983 | r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); | 985 | r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); |
984 | if (!r) { | 986 | if (!r) { |
987 | #ifdef RTC_IRQ | ||
988 | rtc_has_irq = 0; | ||
989 | #endif | ||
985 | printk(KERN_ERR "rtc: I/O resource %lx is not free.\n", | 990 | printk(KERN_ERR "rtc: I/O resource %lx is not free.\n", |
986 | (long)(RTC_PORT(0))); | 991 | (long)(RTC_PORT(0))); |
987 | return -EIO; | 992 | return -EIO; |
@@ -996,6 +1001,7 @@ no_irq: | |||
996 | 1001 | ||
997 | if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) { | 1002 | if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) { |
998 | /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ | 1003 | /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ |
1004 | rtc_has_irq = 0; | ||
999 | printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); | 1005 | printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); |
1000 | if (RTC_IOMAPPED) | 1006 | if (RTC_IOMAPPED) |
1001 | release_region(RTC_PORT(0), RTC_IO_EXTENT); | 1007 | release_region(RTC_PORT(0), RTC_IO_EXTENT); |
@@ -1012,6 +1018,7 @@ no_irq: | |||
1012 | if (misc_register(&rtc_dev)) { | 1018 | if (misc_register(&rtc_dev)) { |
1013 | #ifdef RTC_IRQ | 1019 | #ifdef RTC_IRQ |
1014 | free_irq(RTC_IRQ, NULL); | 1020 | free_irq(RTC_IRQ, NULL); |
1021 | rtc_has_irq = 0; | ||
1015 | #endif | 1022 | #endif |
1016 | release_region(RTC_PORT(0), RTC_IO_EXTENT); | 1023 | release_region(RTC_PORT(0), RTC_IO_EXTENT); |
1017 | return -ENODEV; | 1024 | return -ENODEV; |
@@ -1021,6 +1028,7 @@ no_irq: | |||
1021 | if (!ent) { | 1028 | if (!ent) { |
1022 | #ifdef RTC_IRQ | 1029 | #ifdef RTC_IRQ |
1023 | free_irq(RTC_IRQ, NULL); | 1030 | free_irq(RTC_IRQ, NULL); |
1031 | rtc_has_irq = 0; | ||
1024 | #endif | 1032 | #endif |
1025 | release_region(RTC_PORT(0), RTC_IO_EXTENT); | 1033 | release_region(RTC_PORT(0), RTC_IO_EXTENT); |
1026 | misc_deregister(&rtc_dev); | 1034 | misc_deregister(&rtc_dev); |