diff options
| author | Patrick Mochel <mochel@osdl.org> | 2002-10-17 23:22:18 -0700 |
|---|---|---|
| committer | Patrick Mochel <mochel@osdl.org> | 2002-10-17 23:22:18 -0700 |
| commit | a0424fb7d88cc8ff4c8f787ec3b66e387a5a3247 (patch) | |
| tree | 2d8ab4e9ecb2689f1dda36cea0dbccdc9006096f /drivers/base | |
| parent | 75b74cd4369bb87afc72b0fc614278e8426313bf (diff) | |
driver model: fix matching bug.
If a device didn't match a driver, bus_match() returned 0, and device_attach()
would break out of the loop. So, the first driver was the only one being
checked every time.
Diffstat (limited to 'drivers/base')
| -rw-r--r-- | drivers/base/bus.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 49683a1d3898..207270822e3c 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -96,7 +96,7 @@ static void attach(struct device * dev) static int bus_match(struct device * dev, struct device_driver * drv) { - int error = 0; + int error = -ENODEV; if (dev->bus->match(dev,drv)) { dev->driver = drv; if (drv->probe) { @@ -104,7 +104,8 @@ static int bus_match(struct device * dev, struct device_driver * drv) attach(dev); else dev->driver = NULL; - } + } else + attach(dev); } return error; } |
