[PCMCIA] Check return status of register calls in i82365

From: Herbert Xu
Date: Fri May 21 2004 - 06:57:43 EST


Hi:

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

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1808 -> 1.1809
# drivers/pcmcia/i82365.c 1.51 -> 1.52
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/05/21 herbert@xxxxxxxxxxxxxxxxxxx 1.1809
# [PCMCIA] Check return status of register calls in i82365.
# --------------------------------------------
#
diff -Nru a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c
--- a/drivers/pcmcia/i82365.c Fri May 21 21:53:42 2004
+++ b/drivers/pcmcia/i82365.c Fri May 21 21:53:42 2004
@@ -1372,8 +1372,15 @@
{
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,11 +1389,10 @@

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)