Commit a0424fb7 authored by Patrick Mochel's avatar Patrick Mochel

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. 
parent 75b74cd4
...@@ -96,7 +96,7 @@ static void attach(struct device * dev) ...@@ -96,7 +96,7 @@ static void attach(struct device * dev)
static int bus_match(struct device * dev, struct device_driver * drv) static int bus_match(struct device * dev, struct device_driver * drv)
{ {
int error = 0; int error = -ENODEV;
if (dev->bus->match(dev,drv)) { if (dev->bus->match(dev,drv)) {
dev->driver = drv; dev->driver = drv;
if (drv->probe) { if (drv->probe) {
...@@ -104,7 +104,8 @@ static int bus_match(struct device * dev, struct device_driver * drv) ...@@ -104,7 +104,8 @@ static int bus_match(struct device * dev, struct device_driver * drv)
attach(dev); attach(dev);
else else
dev->driver = NULL; dev->driver = NULL;
} } else
attach(dev);
} }
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment