aboutsummaryrefslogtreecommitdiff
path: root/arch/sparc64/kernel/pci_psycho.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-31 01:33:52 -0700
committerDavid S. Miller <davem@davemloft.net>2008-08-31 01:33:52 -0700
commitd7472c389ee1044d04af8a5b7c51aa7af96ed2db (patch)
tree121b7fae49d8e329405bad97309f48f2ec8d9e8f /arch/sparc64/kernel/pci_psycho.c
parentfd098316ef533e8441576f020ead4beab93154ce (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_psycho.c')
-rw-r--r--arch/sparc64/kernel/pci_psycho.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
index 708212a6e7e..5ee84c5b963 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;
}