aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/pci_psycho.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-31 04:33:52 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-31 04:33:52 -0400
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 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,
1051 p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC); 1051 p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
1052 if (!p) { 1052 if (!p) {
1053 printk(KERN_ERR PFX "Cannot allocate controller info.\n"); 1053 printk(KERN_ERR PFX "Cannot allocate controller info.\n");
1054 goto out_free; 1054 goto out_err;
1055 } 1055 }
1056 1056
1057 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC); 1057 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC);
1058 if (!iommu) { 1058 if (!iommu) {
1059 printk(KERN_ERR PFX "Cannot allocate PBM iommu.\n"); 1059 printk(KERN_ERR PFX "Cannot allocate PBM iommu.\n");
1060 goto out_free; 1060 goto out_free_controller;
1061 } 1061 }
1062 1062
1063 p->pbm_A.iommu = p->pbm_B.iommu = iommu; 1063 p->pbm_A.iommu = p->pbm_B.iommu = iommu;
@@ -1069,7 +1069,7 @@ static int __devinit psycho_probe(struct of_device *op,
1069 err = -ENODEV; 1069 err = -ENODEV;
1070 if (!pr_regs) { 1070 if (!pr_regs) {
1071 printk(KERN_ERR PFX "No reg property.\n"); 1071 printk(KERN_ERR PFX "No reg property.\n");
1072 goto out_free; 1072 goto out_free_iommu;
1073 } 1073 }
1074 1074
1075 p->pbm_A.controller_regs = pr_regs[2].phys_addr; 1075 p->pbm_A.controller_regs = pr_regs[2].phys_addr;
@@ -1082,7 +1082,7 @@ static int __devinit psycho_probe(struct of_device *op,
1082 1082
1083 err = psycho_iommu_init(&p->pbm_A); 1083 err = psycho_iommu_init(&p->pbm_A);
1084 if (err) 1084 if (err)
1085 goto out_free; 1085 goto out_free_iommu;
1086 1086
1087 is_pbm_a = ((pr_regs[0].phys_addr & 0x6000) == 0x2000); 1087 is_pbm_a = ((pr_regs[0].phys_addr & 0x6000) == 0x2000);
1088 1088
@@ -1090,12 +1090,13 @@ static int __devinit psycho_probe(struct of_device *op,
1090 1090
1091 return 0; 1091 return 0;
1092 1092
1093out_free: 1093out_free_iommu:
1094 if (p) { 1094 kfree(p->pbm_A.iommu);
1095 if (p->pbm_A.iommu) 1095
1096 kfree(p->pbm_A.iommu); 1096out_free_controller:
1097 kfree(p); 1097 kfree(p);
1098 } 1098
1099out_err:
1099 return err; 1100 return err;
1100} 1101}
1101 1102