
From: Herbert Xu <herbert@gondor.apana.org.au>

i82365 calls driver_register and platform_device_register without checking
their return values.  This patch fixes that.


---

 25-akpm/drivers/pcmcia/i82365.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff -puN drivers/pcmcia/i82365.c~check-return-status-of-register-calls-in-i82365 drivers/pcmcia/i82365.c
--- 25/drivers/pcmcia/i82365.c~check-return-status-of-register-calls-in-i82365	Fri May 21 16:38:23 2004
+++ 25-akpm/drivers/pcmcia/i82365.c	Fri May 21 16:38:23 2004
@@ -1372,8 +1372,15 @@ static int __init init_i82365(void)
 {
     int i, ret;
 
-    if (driver_register(&i82365_driver))
-	return -1;
+    ret = driver_register(&i82365_driver);
+    if (ret)
+	return ret;
+
+    ret = platform_device_register(&i82365_device);
+    if (ret) {
+	driver_unregister(&i82365_driver);
+	return ret;
+    }
 
     printk(KERN_INFO "Intel ISA PCIC probe: ");
     sockets = 0;
@@ -1382,12 +1389,11 @@ static int __init init_i82365(void)
 
     if (sockets == 0) {
 	printk("not found.\n");
+	platform_device_unregister(&i82365_device);
 	driver_unregister(&i82365_driver);
 	return -ENODEV;
     }
 
-    platform_device_register(&i82365_device);
-
     /* Set up interrupt handler(s) */
     if (grab_irq != 0)
 	request_irq(cs_irq, pcic_interrupt, 0, "i82365", pcic_interrupt);

_
