patch-2.4.21 linux-2.4.21/drivers/sbus/char/bbc_i2c.c

Next file: linux-2.4.21/drivers/sbus/char/display7seg.c
Previous file: linux-2.4.21/drivers/sbus/char/bbc_envctrl.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.20/drivers/sbus/char/bbc_i2c.c linux-2.4.21/drivers/sbus/char/bbc_i2c.c
@@ -427,14 +427,15 @@
 	return 0;
 }
 
-extern void bbc_envctrl_init(void);
+extern int bbc_envctrl_init(void);
 extern void bbc_envctrl_cleanup(void);
+static void bbc_i2c_cleanup(void);
 
 static int __init bbc_i2c_init(void)
 {
 	struct linux_ebus *ebus = NULL;
 	struct linux_ebus_device *edev = NULL;
-	int index = 0;
+	int err, index = 0;
 
 	if (tlb_type != cheetah || !bbc_present())
 		return -ENODEV;
@@ -451,11 +452,13 @@
 	if (!index)
 		return -ENODEV;
 
-	bbc_envctrl_init();
-	return 0;
+	err = bbc_envctrl_init();
+	if (err)
+		bbc_i2c_cleanup();
+	return err;
 }
 
-static void __exit bbc_i2c_cleanup(void)
+static void bbc_i2c_cleanup(void)
 {
 	struct bbc_i2c_bus *bp = all_bbc_i2c;
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)