diff options
author | David S. Miller <davem@davemloft.net> | 2008-08-31 10:33:52 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-31 10:33:52 +0200 |
commit | d7472c389ee1044d04af8a5b7c51aa7af96ed2db (patch) | |
tree | 121b7fae49d8e329405bad97309f48f2ec8d9e8f /arch/sparc64/kernel/pci_psycho.c | |
parent | sparc: Annotate of_device_id arrays with const or __initdata. (diff) | |
download | linux-d7472c389ee1044d04af8a5b7c51aa7af96ed2db.tar.xz linux-d7472c389ee1044d04af8a5b7c51aa7af96ed2db.zip |
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_psycho.c')
-rw-r--r-- | arch/sparc64/kernel/pci_psycho.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c index 708212a6e7eb..5ee84c5b9636 100644 --- a/arch/sparc64/kernel/pci_psycho.c +++ b/arch/sparc64/kernel/pci_psycho.c @@ -1051,13 +1051,13 @@ static int __devinit psycho_probe(struct of_device *op, p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC); if (!p) { printk(KERN_ERR PFX "Cannot allocate controller info.\n"); - goto out_free; + goto out_err; } iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC); if (!iommu) { printk(KERN_ERR PFX "Cannot allocate PBM iommu.\n"); - goto out_free; + goto out_free_controller; } p->pbm_A.iommu = p->pbm_B.iommu = iommu; @@ -1069,7 +1069,7 @@ static int __devinit psycho_probe(struct of_device *op, err = -ENODEV; if (!pr_regs) { printk(KERN_ERR PFX "No reg property.\n"); - goto out_free; + goto out_free_iommu; } p->pbm_A.controller_regs = pr_regs[2].phys_addr; @@ -1082,7 +1082,7 @@ static int __devinit psycho_probe(struct of_device *op, err = psycho_iommu_init(&p->pbm_A); if (err) - goto out_free; + goto out_free_iommu; is_pbm_a = ((pr_regs[0].phys_addr & 0x6000) == 0x2000); @@ -1090,12 +1090,13 @@ static int __devinit psycho_probe(struct of_device *op, return 0; -out_free: - if (p) { - if (p->pbm_A.iommu) - kfree(p->pbm_A.iommu); - kfree(p); - } +out_free_iommu: + kfree(p->pbm_A.iommu); + +out_free_controller: + kfree(p); + +out_err: return err; } |