diff options
author | David S. Miller <davem@davemloft.net> | 2008-08-31 04:33:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-31 04:33:52 -0400 |
commit | d7472c389ee1044d04af8a5b7c51aa7af96ed2db (patch) | |
tree | 121b7fae49d8e329405bad97309f48f2ec8d9e8f /arch/sparc64/kernel/pci_fire.c | |
parent | fd098316ef533e8441576f020ead4beab93154ce (diff) |
sparc64: Simplify error handling in PCI controller probing.
Based upon suggestions from Stephen Rothwell.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/pci_fire.c')
-rw-r--r-- | arch/sparc64/kernel/pci_fire.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/arch/sparc64/kernel/pci_fire.c b/arch/sparc64/kernel/pci_fire.c index 477928aad538..4fb1ef92cb16 100644 --- a/arch/sparc64/kernel/pci_fire.c +++ b/arch/sparc64/kernel/pci_fire.c | |||
@@ -515,13 +515,13 @@ static int __devinit fire_probe(struct of_device *op, | |||
515 | p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC); | 515 | p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC); |
516 | if (!p) { | 516 | if (!p) { |
517 | printk(KERN_ERR PFX "Cannot allocate controller info.\n"); | 517 | printk(KERN_ERR PFX "Cannot allocate controller info.\n"); |
518 | goto out_free; | 518 | goto out_err; |
519 | } | 519 | } |
520 | 520 | ||
521 | iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC); | 521 | iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC); |
522 | if (!iommu) { | 522 | if (!iommu) { |
523 | printk(KERN_ERR PFX "Cannot allocate PBM A iommu.\n"); | 523 | printk(KERN_ERR PFX "Cannot allocate PBM A iommu.\n"); |
524 | goto out_free; | 524 | goto out_free_controller; |
525 | } | 525 | } |
526 | 526 | ||
527 | p->pbm_A.iommu = iommu; | 527 | p->pbm_A.iommu = iommu; |
@@ -529,21 +529,20 @@ static int __devinit fire_probe(struct of_device *op, | |||
529 | iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC); | 529 | iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC); |
530 | if (!iommu) { | 530 | if (!iommu) { |
531 | printk(KERN_ERR PFX "Cannot allocate PBM A iommu.\n"); | 531 | printk(KERN_ERR PFX "Cannot allocate PBM A iommu.\n"); |
532 | goto out_free; | 532 | goto out_free_iommu_A; |
533 | } | 533 | } |
534 | 534 | ||
535 | p->pbm_B.iommu = iommu; | 535 | p->pbm_B.iommu = iommu; |
536 | 536 | ||
537 | return pci_fire_pbm_init(p, dp, portid); | 537 | return pci_fire_pbm_init(p, dp, portid); |
538 | 538 | ||
539 | out_free: | 539 | out_free_iommu_A: |
540 | if (p) { | 540 | kfree(p->pbm_A.iommu); |
541 | if (p->pbm_A.iommu) | 541 | |
542 | kfree(p->pbm_A.iommu); | 542 | out_free_controller: |
543 | if (p->pbm_B.iommu) | 543 | kfree(p); |
544 | kfree(p->pbm_B.iommu); | 544 | |
545 | kfree(p); | 545 | out_err: |
546 | } | ||
547 | return err; | 546 | return err; |
548 | } | 547 | } |
549 | 548 | ||