Commit fb6647a6 authored by Adam Belay's avatar Adam Belay Committed by Linus Torvalds

[PNP] minor resource management fixes

This patch fixes a bug in pnp_auto_config_dev in which it wouldn't always report 
allocation failures.  It also corrects the return codes.
parent 9a2fc853
......@@ -452,23 +452,19 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
if (!dev->dependent) {
if (pnp_assign_resources(dev, 0))
return 1;
else
return 0;
} else {
dep = dev->dependent;
do {
if (pnp_assign_resources(dev, i))
return 0;
dep = dep->next;
i++;
} while (dep);
}
dep = dev->dependent;
do {
if (pnp_assign_resources(dev, i))
return 1;
/* if this dependent resource failed, try the next one */
dep = dep->next;
i++;
} while (dep);
pnp_err("Unable to assign resources to device %s.", dev->dev.bus_id);
return 0;
return -EBUSY;
}
/**
......@@ -486,7 +482,7 @@ int pnp_activate_dev(struct pnp_dev *dev)
}
/* ensure resources are allocated */
if (!pnp_auto_config_dev(dev))
if (pnp_auto_config_dev(dev))
return -EBUSY;
if (!pnp_can_write(dev)) {
......
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