diff options
| author | Patrick Mochel <mochel@osdl.org> | 2003-01-09 07:16:26 -0600 |
|---|---|---|
| committer | Patrick Mochel <mochel@osdl.org> | 2003-01-09 07:16:26 -0600 |
| commit | c1848c1e0ec236d118cb7e28fb0e8b56f286b366 (patch) | |
| tree | 486b47f59c158414e39e0ab90355543681186af0 | |
| parent | 7ce8b3a1df3a125457b3ea29945d71de81901dc3 (diff) | |
driver model: remove extra error check during driver binding.
Some of the error checks added in last changeset caused unwanted behavior
(like panicking on boot).
This removes the checks of bus_match() in driver_attach().
| -rw-r--r-- | drivers/base/bus.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 22e1c98d7bf4..e682965bb062 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -312,12 +312,14 @@ static int device_attach(struct device * dev) * If bus_match() returns 0 and the @dev->driver is set, we've found * a compatible pair, so we call devclass_add_device() to add the * device to the class. + * + * Note that we ignore the error from bus_match(), since it's perfectly + * valid for a driver not to bind to any devices. */ static int driver_attach(struct device_driver * drv) { struct bus_type * bus = drv->bus; struct list_head * entry; - int error = 0; if (!bus->match) return 0; @@ -325,12 +327,11 @@ static int driver_attach(struct device_driver * drv) list_for_each(entry,&bus->devices.list) { struct device * dev = container_of(entry,struct device,bus_list); if (!dev->driver) { - error = bus_match(dev,drv); - if (!error && dev->driver) - error = devclass_add_device(dev); + if (!bus_match(dev,drv) && dev->driver) + devclass_add_device(dev); } } - return error; + return 0; } @@ -437,8 +438,10 @@ int bus_add_driver(struct device_driver * drv) strncpy(drv->kobj.name,drv->name,KOBJ_NAME_LEN); drv->kobj.kset = &bus->drivers; - if ((error = kobject_register(&drv->kobj))) - goto Done; + if ((error = kobject_register(&drv->kobj))) { + put_bus(bus); + return error; + } down_write(&bus->subsys.rwsem); if (!(error = devclass_add_driver(drv))) { @@ -448,7 +451,6 @@ int bus_add_driver(struct device_driver * drv) } up_write(&bus->subsys.rwsem); - Done: if (error) { kobject_unregister(&drv->kobj); put_bus(bus); |
