aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChristophe Lucas <clucas@rotomalug.org>2005-09-10 03:26:29 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-10 13:06:25 -0400
commit819a3eba4233ffc6c125e1bf0a15ae093b97c3a6 (patch)
tree0af8236a189598bc93db98c1fae5fc6f74545708 /drivers
parent5ce7852cdf07ab903fb1c72d0915ac492c6e07c7 (diff)
[PATCH] applicom: fix error handling
misc_register() can fail. Signed-off-by: Christophe Lucas <clucas@rotomalug.org> Signed-off-by: Domen Puncer <domen@coderock.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/applicom.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index 11f9ee581124..927a5bbe112c 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -172,7 +172,7 @@ static int ac_register_board(unsigned long physloc, void __iomem *loc,
172 172
173void cleanup_module(void) 173void cleanup_module(void)
174{ 174{
175 int i; 175 unsigned int i;
176 176
177 misc_deregister(&ac_miscdev); 177 misc_deregister(&ac_miscdev);
178 178
@@ -195,7 +195,7 @@ int __init applicom_init(void)
195 int i, numisa = 0; 195 int i, numisa = 0;
196 struct pci_dev *dev = NULL; 196 struct pci_dev *dev = NULL;
197 void __iomem *RamIO; 197 void __iomem *RamIO;
198 int boardno; 198 int boardno, ret;
199 199
200 printk(KERN_INFO "Applicom driver: $Id: ac.c,v 1.30 2000/03/22 16:03:57 dwmw2 Exp $\n"); 200 printk(KERN_INFO "Applicom driver: $Id: ac.c,v 1.30 2000/03/22 16:03:57 dwmw2 Exp $\n");
201 201
@@ -294,7 +294,8 @@ int __init applicom_init(void)
294 } 294 }
295 295
296 if (!numisa) 296 if (!numisa)
297 printk(KERN_WARNING"ac.o: No valid ISA Applicom boards found at mem 0x%lx\n",mem); 297 printk(KERN_WARNING "ac.o: No valid ISA Applicom boards found "
298 "at mem 0x%lx\n", mem);
298 299
299 fin: 300 fin:
300 init_waitqueue_head(&FlagSleepRec); 301 init_waitqueue_head(&FlagSleepRec);
@@ -304,7 +305,11 @@ int __init applicom_init(void)
304 DeviceErrorCount = 0; 305 DeviceErrorCount = 0;
305 306
306 if (numboards) { 307 if (numboards) {
307 misc_register(&ac_miscdev); 308 ret = misc_register(&ac_miscdev);
309 if (ret) {
310 printk(KERN_WARNING "ac.o: Unable to register misc device\n");
311 goto out;
312 }
308 for (i = 0; i < MAX_BOARD; i++) { 313 for (i = 0; i < MAX_BOARD; i++) {
309 int serial; 314 int serial;
310 char boardname[(SERIAL_NUMBER - TYPE_CARD) + 1]; 315 char boardname[(SERIAL_NUMBER - TYPE_CARD) + 1];
@@ -337,6 +342,17 @@ int __init applicom_init(void)
337 342
338 else 343 else
339 return -ENXIO; 344 return -ENXIO;
345
346out:
347 for (i = 0; i < MAX_BOARD; i++) {
348 if (!apbs[i].RamIO)
349 continue;
350 if (apbs[i].irq)
351 free_irq(apbs[i].irq, &dummy);
352 iounmap(apbs[i].RamIO);
353 }
354 pci_disable_device(dev);
355 return ret;
340} 356}
341 357
342 358