PCI: don't say we claimed a resource if we failed
authorBjorn Helgaas <bjorn.helgaas@hp.com>
Mon, 22 Mar 2010 22:34:05 +0000 (16:34 -0600)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Thu, 25 Mar 2010 15:51:35 +0000 (08:51 -0700)
pci_claim_resource() can fail, so pay attention and only claim success
when it actually succeeded.  If pci_claim_resource() fails, it prints a
useful diagnostic.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/quirks.c

index f6bbb9c..3ea0b29 100644 (file)
@@ -368,8 +368,9 @@ static void __devinit quirk_io_region(struct pci_dev *dev, unsigned region,
                bus_region.end = res->end;
                pcibios_bus_to_resource(dev, res, &bus_region);
 
-               pci_claim_resource(dev, nr);
-               dev_info(&dev->dev, "quirk: %pR claimed by %s\n", res, name);
+               if (pci_claim_resource(dev, nr) == 0)
+                       dev_info(&dev->dev, "quirk: %pR claimed by %s\n",
+                                res, name);
        }
 }