aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-06-05 16:22:11 -0400
committerBjorn Helgaas <bhelgaas@google.com>2013-06-14 19:39:45 -0400
commit050134864c1c76f49eb86c134a0e02fb3c196382 (patch)
treefef3595723b29f4659feebfba2560f90dcea3646 /drivers/pci
parentdc087f2f6a2925e81831f3016b9cbb6e470e7423 (diff)
PCI: Return early on allocation failures to unindent mainline code
On allocation failure, return early so the main body of the function doesn't have to be indented as the body of an "if" statement. No functional change. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/probe.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index a723b2b93ab4..14af6ef4959c 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -451,20 +451,21 @@ void pci_read_bridge_bases(struct pci_bus *child)
451 } 451 }
452} 452}
453 453
454static struct pci_bus * pci_alloc_bus(void) 454static struct pci_bus *pci_alloc_bus(void)
455{ 455{
456 struct pci_bus *b; 456 struct pci_bus *b;
457 457
458 b = kzalloc(sizeof(*b), GFP_KERNEL); 458 b = kzalloc(sizeof(*b), GFP_KERNEL);
459 if (b) { 459 if (!b)
460 INIT_LIST_HEAD(&b->node); 460 return NULL;
461 INIT_LIST_HEAD(&b->children); 461
462 INIT_LIST_HEAD(&b->devices); 462 INIT_LIST_HEAD(&b->node);
463 INIT_LIST_HEAD(&b->slots); 463 INIT_LIST_HEAD(&b->children);
464 INIT_LIST_HEAD(&b->resources); 464 INIT_LIST_HEAD(&b->devices);
465 b->max_bus_speed = PCI_SPEED_UNKNOWN; 465 INIT_LIST_HEAD(&b->slots);
466 b->cur_bus_speed = PCI_SPEED_UNKNOWN; 466 INIT_LIST_HEAD(&b->resources);
467 } 467 b->max_bus_speed = PCI_SPEED_UNKNOWN;
468 b->cur_bus_speed = PCI_SPEED_UNKNOWN;
468 return b; 469 return b;
469} 470}
470 471
@@ -485,11 +486,11 @@ static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)
485 struct pci_host_bridge *bridge; 486 struct pci_host_bridge *bridge;
486 487
487 bridge = kzalloc(sizeof(*bridge), GFP_KERNEL); 488 bridge = kzalloc(sizeof(*bridge), GFP_KERNEL);
488 if (bridge) { 489 if (!bridge)
489 INIT_LIST_HEAD(&bridge->windows); 490 return NULL;
490 bridge->bus = b;
491 }
492 491
492 INIT_LIST_HEAD(&bridge->windows);
493 bridge->bus = b;
493 return bridge; 494 return bridge;
494} 495}
495 496