summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Belay <ambx1@neo.rr.com>2004-04-14 04:28:04 +0000
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-04-14 04:28:04 +0000
commitfb6647a62f4b27b0d17dd023f8fa4575fc3dc7b2 (patch)
treefce2de8c97e394134505b89d103d2fb649dd54e5
parent9a2fc853724a8e2dc094bbe13584289e7611f603 (diff)
[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.
-rw-r--r--drivers/pnp/manager.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index bd344233e5e8..b31a33a875b5 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -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)) {