aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2014-07-04 17:58:15 -0400
committerBjorn Helgaas <bhelgaas@google.com>2014-07-08 18:29:08 -0400
commit28f6dbe2c669c6a02c04c8ece21cafbcb20370ab (patch)
treeeaf95abc97f3ca393daea296d5f8b282077a8391
parent096d4221f92fb205ade35f35e3ceeba5662528fe (diff)
PCI: Cleanup control flow
Return errors immediately so the straightline path is the normal, no-error path. No functional change. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/setup-res.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 481c4e18693a..532dc540dc5d 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -305,14 +305,16 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
305 if (ret < 0) 305 if (ret < 0)
306 ret = pci_revert_fw_address(res, dev, resno, size); 306 ret = pci_revert_fw_address(res, dev, resno, size);
307 307
308 if (!ret) { 308 if (ret)
309 res->flags &= ~IORESOURCE_UNSET; 309 return ret;
310 res->flags &= ~IORESOURCE_STARTALIGN; 310
311 dev_info(&dev->dev, "BAR %d: assigned %pR\n", resno, res); 311 res->flags &= ~IORESOURCE_UNSET;
312 if (resno < PCI_BRIDGE_RESOURCES) 312 res->flags &= ~IORESOURCE_STARTALIGN;
313 pci_update_resource(dev, resno); 313 dev_info(&dev->dev, "BAR %d: assigned %pR\n", resno, res);
314 } 314 if (resno < PCI_BRIDGE_RESOURCES)
315 return ret; 315 pci_update_resource(dev, resno);
316
317 return 0;
316} 318}
317EXPORT_SYMBOL(pci_assign_resource); 319EXPORT_SYMBOL(pci_assign_resource);
318 320
@@ -335,19 +337,20 @@ int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsiz
335 /* already aligned with min_align */ 337 /* already aligned with min_align */
336 new_size = resource_size(res) + addsize; 338 new_size = resource_size(res) + addsize;
337 ret = _pci_assign_resource(dev, resno, new_size, min_align); 339 ret = _pci_assign_resource(dev, resno, new_size, min_align);
338 if (!ret) { 340 if (ret) {
339 res->flags &= ~IORESOURCE_UNSET;
340 res->flags &= ~IORESOURCE_STARTALIGN;
341 dev_info(&dev->dev, "BAR %d: reassigned %pR\n", resno, res);
342 if (resno < PCI_BRIDGE_RESOURCES)
343 pci_update_resource(dev, resno);
344 } else {
345 res->flags = flags; 341 res->flags = flags;
346 dev_info(&dev->dev, "BAR %d: %pR (failed to expand by %#llx)\n", 342 dev_info(&dev->dev, "BAR %d: %pR (failed to expand by %#llx)\n",
347 resno, res, (unsigned long long) addsize); 343 resno, res, (unsigned long long) addsize);
344 return ret;
348 } 345 }
349 346
350 return ret; 347 res->flags &= ~IORESOURCE_UNSET;
348 res->flags &= ~IORESOURCE_STARTALIGN;
349 dev_info(&dev->dev, "BAR %d: reassigned %pR\n", resno, res);
350 if (resno < PCI_BRIDGE_RESOURCES)
351 pci_update_resource(dev, resno);
352
353 return 0;
351} 354}
352 355
353int pci_enable_resources(struct pci_dev *dev, int mask) 356int pci_enable_resources(struct pci_dev *dev, int mask)