Skip to content

Commit

Permalink
PCI: Simplify __pci_assign_resource() coding style
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bjorn Helgaas committed May 23, 2014

Unverified

No user is associated with the committer email.
1 parent 30afe8d commit d3689df
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/pci/setup-res.c
Original file line number Diff line number Diff line change
@@ -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.
*

0 comments on commit d3689df

Please sign in to comment.