diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2014-02-26 13:25:59 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-02-27 12:43:33 -0500 |
commit | 29003beb7f15d3daa5a8f9afb8d007b64baa2357 (patch) | |
tree | 5b886a8b36edc5ee740db82a4f583f15b3c7b24a /drivers/pci/setup-res.c | |
parent | cd8a4d3657c3f2cf9ce3780707be1debb8fea6e2 (diff) |
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.c | 15 |
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) | |||
111 | struct resource *res = &dev->resource[resource]; | 111 | struct resource *res = &dev->resource[resource]; |
112 | struct resource *root, *conflict; | 112 | struct resource *root, *conflict; |
113 | 113 | ||
114 | if (res->flags & IORESOURCE_UNSET) { | ||
115 | dev_info(&dev->dev, "can't claim BAR %d %pR: no address assigned\n", | ||
116 | resource, res); | ||
117 | return -EINVAL; | ||
118 | } | ||
119 | |||
114 | root = pci_find_parent_resource(dev, res); | 120 | root = pci_find_parent_resource(dev, res); |
115 | if (!root) { | 121 | if (!root) { |
116 | dev_info(&dev->dev, "no compatible bridge window for %pR\n", | 122 | dev_info(&dev->dev, "can't claim BAR %d %pR: no compatible bridge window\n", |
117 | res); | 123 | resource, res); |
118 | return -EINVAL; | 124 | return -EINVAL; |
119 | } | 125 | } |
120 | 126 | ||
121 | conflict = request_resource_conflict(root, res); | 127 | conflict = request_resource_conflict(root, res); |
122 | if (conflict) { | 128 | if (conflict) { |
123 | dev_info(&dev->dev, | 129 | dev_info(&dev->dev, "can't claim BAR %d %pR: address conflict with %s %pR\n", |
124 | "address space collision: %pR conflicts with %s %pR\n", | 130 | resource, res, conflict->name, conflict); |
125 | res, conflict->name, conflict); | ||
126 | return -EBUSY; | 131 | return -EBUSY; |
127 | } | 132 | } |
128 | 133 | ||