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_sabre.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_sabre.c')
-rw-r--r-- | arch/sparc64/kernel/pci_sabre.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c index cc476e9a275e..eee8fdca3820 100644 --- a/arch/sparc64/kernel/pci_sabre.c +++ b/arch/sparc64/kernel/pci_sabre.c | |||
@@ -786,13 +786,13 @@ static int __devinit sabre_probe(struct of_device *op, | |||
786 | p = kzalloc(sizeof(*p), GFP_ATOMIC); | 786 | p = kzalloc(sizeof(*p), GFP_ATOMIC); |
787 | if (!p) { | 787 | if (!p) { |
788 | printk(KERN_ERR PFX "Cannot allocate controller info.\n"); | 788 | printk(KERN_ERR PFX "Cannot allocate controller info.\n"); |
789 | goto out_free; | 789 | goto out_err; |
790 | } | 790 | } |
791 | 791 | ||
792 | iommu = kzalloc(sizeof(*iommu), GFP_ATOMIC); | 792 | iommu = kzalloc(sizeof(*iommu), GFP_ATOMIC); |
793 | if (!iommu) { | 793 | if (!iommu) { |
794 | printk(KERN_ERR PFX "Cannot allocate PBM iommu.\n"); | 794 | printk(KERN_ERR PFX "Cannot allocate PBM iommu.\n"); |
795 | goto out_free; | 795 | goto out_free_controller; |
796 | } | 796 | } |
797 | 797 | ||
798 | pbm = &p->pbm_A; | 798 | pbm = &p->pbm_A; |
@@ -813,7 +813,7 @@ static int __devinit sabre_probe(struct of_device *op, | |||
813 | err = -ENODEV; | 813 | err = -ENODEV; |
814 | if (!pr_regs) { | 814 | if (!pr_regs) { |
815 | printk(KERN_ERR PFX "No reg property\n"); | 815 | printk(KERN_ERR PFX "No reg property\n"); |
816 | goto out_free; | 816 | goto out_free_iommu; |
817 | } | 817 | } |
818 | 818 | ||
819 | /* | 819 | /* |
@@ -843,7 +843,7 @@ static int __devinit sabre_probe(struct of_device *op, | |||
843 | vdma = of_get_property(dp, "virtual-dma", NULL); | 843 | vdma = of_get_property(dp, "virtual-dma", NULL); |
844 | if (!vdma) { | 844 | if (!vdma) { |
845 | printk(KERN_ERR PFX "No virtual-dma property\n"); | 845 | printk(KERN_ERR PFX "No virtual-dma property\n"); |
846 | goto out_free; | 846 | goto out_free_iommu; |
847 | } | 847 | } |
848 | 848 | ||
849 | dma_mask = vdma[0]; | 849 | dma_mask = vdma[0]; |
@@ -863,12 +863,12 @@ static int __devinit sabre_probe(struct of_device *op, | |||
863 | break; | 863 | break; |
864 | default: | 864 | default: |
865 | printk(KERN_ERR PFX "Strange virtual-dma size.\n"); | 865 | printk(KERN_ERR PFX "Strange virtual-dma size.\n"); |
866 | goto out_free; | 866 | goto out_free_iommu; |
867 | } | 867 | } |
868 | 868 | ||
869 | err = sabre_iommu_init(pbm, tsbsize, vdma[0], dma_mask); | 869 | err = sabre_iommu_init(pbm, tsbsize, vdma[0], dma_mask); |
870 | if (err) | 870 | if (err) |
871 | goto out_free; | 871 | goto out_free_iommu; |
872 | 872 | ||
873 | /* | 873 | /* |
874 | * Look for APB underneath. | 874 | * Look for APB underneath. |
@@ -876,12 +876,13 @@ static int __devinit sabre_probe(struct of_device *op, | |||
876 | sabre_pbm_init(p, pbm, dp); | 876 | sabre_pbm_init(p, pbm, dp); |
877 | return 0; | 877 | return 0; |
878 | 878 | ||
879 | out_free: | 879 | out_free_iommu: |
880 | if (p) { | 880 | kfree(p->pbm_A.iommu); |
881 | if (p->pbm_A.iommu) | 881 | |
882 | kfree(p->pbm_A.iommu); | 882 | out_free_controller: |
883 | kfree(p); | 883 | kfree(p); |
884 | } | 884 | |
885 | out_err: | ||
885 | return err; | 886 | return err; |
886 | } | 887 | } |
887 | 888 | ||