summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2014-05-20 02:39:07 +0200
committerBjorn Helgaas <bhelgaas@google.com>2014-05-23 20:40:49 +0200
commitd3689df04445c568c8b3dfcd8db4b562e1b18cfb (patch)
tree11e5c253120cf5f7e76e7324610934c792b76622
parentPCI: Change pbus_size_mem() return values to be more conventional (diff)
downloadlinux-d3689df04445c568c8b3dfcd8db4b562e1b18cfb.tar.xz
linux-d3689df04445c568c8b3dfcd8db4b562e1b18cfb.zip
PCI: Simplify __pci_assign_resource() coding style
If an allocation succeeds, we can return success immediately. Then we don't have to test for success in the subsequent code. No functional change. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/setup-res.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 2473f091a9cc..3bdac9dc4a88 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -213,9 +213,10 @@ static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev,
ret = pci_bus_alloc_resource(bus, res, size, align, min,
IORESOURCE_PREFETCH | IORESOURCE_MEM_64,
pcibios_align_resource, dev);
+ if (ret == 0)
+ return 0;
- if (ret < 0 &&
- (res->flags & (IORESOURCE_PREFETCH | IORESOURCE_MEM_64)) ==
+ if ((res->flags & (IORESOURCE_PREFETCH | IORESOURCE_MEM_64)) ==
(IORESOURCE_PREFETCH | IORESOURCE_MEM_64)) {
/*
* That failed.
@@ -225,10 +226,11 @@ static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev,
ret = pci_bus_alloc_resource(bus, res, size, align, min,
IORESOURCE_PREFETCH,
pcibios_align_resource, dev);
+ if (ret == 0)
+ return 0;
}
- if (ret < 0 &&
- (res->flags & (IORESOURCE_PREFETCH | IORESOURCE_MEM_64))) {
+ if (res->flags & (IORESOURCE_PREFETCH | IORESOURCE_MEM_64)) {
/*
* That failed.
*