i2c-isa: Fail adding driver on attach_adapter error
authorDavid Hubbard <david.c.hubbard@gmail.com>
Sun, 3 Sep 2006 20:21:20 +0000 (22:21 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 26 Sep 2006 22:38:51 +0000 (15:38 -0700)
i2c-isa: Fail adding driver on attach_adapter error

Signed-off-by: David Hubbard <david.c.hubbard@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/i2c/busses/i2c-isa.c

index d7486e586068d81f7f44541b15ba1e6b656ed3db..7a8d2c148a801c546b306c3e73a92ea02cd450a6 100644 (file)
@@ -89,9 +89,14 @@ int i2c_isa_add_driver(struct i2c_driver *driver)
        dev_dbg(&isa_adapter.dev, "Driver %s registered\n", driver->driver.name);
 
        /* Now look for clients */
-       driver->attach_adapter(&isa_adapter);
-
-       return 0;
+       res = driver->attach_adapter(&isa_adapter);
+       if (res) {
+               dev_err(&isa_adapter.dev,
+                       "Driver %s failed to attach adapter, unregistering\n",
+                       driver->driver.name);
+               driver_unregister(&driver->driver);
+       }
+       return res;
 }
 
 int i2c_isa_del_driver(struct i2c_driver *driver)