From: David Hubbard Date: Sun, 3 Sep 2006 20:21:20 +0000 (+0200) Subject: i2c-isa: Fail adding driver on attach_adapter error X-Git-Tag: v2.6.19-rc1~1003^2~10 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8202632647278eba7223727dc442f49227c040d0;p=linux-2.6 i2c-isa: Fail adding driver on attach_adapter error i2c-isa: Fail adding driver on attach_adapter error Signed-off-by: David Hubbard Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c index d7486e5860..7a8d2c148a 100644 --- a/drivers/i2c/busses/i2c-isa.c +++ b/drivers/i2c/busses/i2c-isa.c @@ -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)