summaryrefslogtreecommitdiffstats
path: root/drivers/pci/setup-res.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2014-02-26 19:25:59 +0100
committerBjorn Helgaas <bhelgaas@google.com>2014-02-27 18:43:33 +0100
commit29003beb7f15d3daa5a8f9afb8d007b64baa2357 (patch)
tree5b886a8b36edc5ee740db82a4f583f15b3c7b24a /drivers/pci/setup-res.c
parentPCI: Check IORESOURCE_UNSET before updating BAR (diff)
downloadlinux-29003beb7f15d3daa5a8f9afb8d007b64baa2357.tar.xz
linux-29003beb7f15d3daa5a8f9afb8d007b64baa2357.zip
PCI: Don't try to claim IORESOURCE_UNSET resources
If the IORESOURCE_UNSET bit is set, it means we haven't assigned an address yet, so don't try to claim the region. Also, make the error messages more uniform and add info about which BAR is involved. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/setup-res.c')
-rw-r--r--drivers/pci/setup-res.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 7f7652176fc5..6e443135ba24 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -111,18 +111,23 @@ int pci_claim_resource(struct pci_dev *dev, int resource)
struct resource *res = &dev->resource[resource];
struct resource *root, *conflict;
+ if (res->flags & IORESOURCE_UNSET) {
+ dev_info(&dev->dev, "can't claim BAR %d %pR: no address assigned\n",
+ resource, res);
+ return -EINVAL;
+ }
+
root = pci_find_parent_resource(dev, res);
if (!root) {
- dev_info(&dev->dev, "no compatible bridge window for %pR\n",
- res);
+ dev_info(&dev->dev, "can't claim BAR %d %pR: no compatible bridge window\n",
+ resource, res);
return -EINVAL;
}
conflict = request_resource_conflict(root, res);
if (conflict) {
- dev_info(&dev->dev,
- "address space collision: %pR conflicts with %s %pR\n",
- res, conflict->name, conflict);
+ dev_info(&dev->dev, "can't claim BAR %d %pR: address conflict with %s %pR\n",
+ resource, res, conflict->name, conflict);
return -EBUSY;
}