aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Yang <leoli@freescale.com>2008-05-30 02:25:45 -0400
committerDan Williams <dan.j.williams@intel.com>2008-07-08 14:57:45 -0400
commit51ee87f27a1d2c0e08492924f2fb0223c4c704d9 (patch)
tree4c2ede7b480144a1b20441c164761881c3df9f47
parent0a2ce2ffc358da96792d514c1024b72c52be9cc1 (diff)
fsldma: fix incorrect exit path for initialization
Signed-off-by: Li Yang <leoli@freescale.com> Acked-by: Zhang Wei <zw@zh-kernel.org> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--drivers/dma/fsldma.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index 054eabffc185..724f6fdd0af6 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -809,8 +809,7 @@ static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan)
809 if (!src) { 809 if (!src) {
810 dev_err(fsl_chan->dev, 810 dev_err(fsl_chan->dev,
811 "selftest: Cannot alloc memory for test!\n"); 811 "selftest: Cannot alloc memory for test!\n");
812 err = -ENOMEM; 812 return -ENOMEM;
813 goto out;
814 } 813 }
815 814
816 dest = src + test_size; 815 dest = src + test_size;
@@ -842,7 +841,7 @@ static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan)
842 if (fsl_dma_is_complete(chan, cookie, NULL, NULL) != DMA_SUCCESS) { 841 if (fsl_dma_is_complete(chan, cookie, NULL, NULL) != DMA_SUCCESS) {
843 dev_err(fsl_chan->dev, "selftest: Time out!\n"); 842 dev_err(fsl_chan->dev, "selftest: Time out!\n");
844 err = -ENODEV; 843 err = -ENODEV;
845 goto out; 844 goto free_resources;
846 } 845 }
847 846
848 /* Test free and re-alloc channel resources */ 847 /* Test free and re-alloc channel resources */
@@ -927,8 +926,7 @@ static int __devinit of_fsl_dma_chan_probe(struct of_device *dev,
927 if (!new_fsl_chan) { 926 if (!new_fsl_chan) {
928 dev_err(&dev->dev, "No free memory for allocating " 927 dev_err(&dev->dev, "No free memory for allocating "
929 "dma channels!\n"); 928 "dma channels!\n");
930 err = -ENOMEM; 929 return -ENOMEM;
931 goto err;
932 } 930 }
933 931
934 /* get dma channel register base */ 932 /* get dma channel register base */
@@ -936,7 +934,7 @@ static int __devinit of_fsl_dma_chan_probe(struct of_device *dev,
936 if (err) { 934 if (err) {
937 dev_err(&dev->dev, "Can't get %s property 'reg'\n", 935 dev_err(&dev->dev, "Can't get %s property 'reg'\n",
938 dev->node->full_name); 936 dev->node->full_name);
939 goto err; 937 goto err_no_reg;
940 } 938 }
941 939
942 new_fsl_chan->feature = *(u32 *)match->data; 940 new_fsl_chan->feature = *(u32 *)match->data;
@@ -958,7 +956,7 @@ static int __devinit of_fsl_dma_chan_probe(struct of_device *dev,
958 dev_err(&dev->dev, "There is no %d channel!\n", 956 dev_err(&dev->dev, "There is no %d channel!\n",
959 new_fsl_chan->id); 957 new_fsl_chan->id);
960 err = -EINVAL; 958 err = -EINVAL;
961 goto err; 959 goto err_no_chan;
962 } 960 }
963 fdev->chan[new_fsl_chan->id] = new_fsl_chan; 961 fdev->chan[new_fsl_chan->id] = new_fsl_chan;
964 tasklet_init(&new_fsl_chan->tasklet, dma_do_tasklet, 962 tasklet_init(&new_fsl_chan->tasklet, dma_do_tasklet,
@@ -997,23 +995,26 @@ static int __devinit of_fsl_dma_chan_probe(struct of_device *dev,
997 if (err) { 995 if (err) {
998 dev_err(&dev->dev, "DMA channel %s request_irq error " 996 dev_err(&dev->dev, "DMA channel %s request_irq error "
999 "with return %d\n", dev->node->full_name, err); 997 "with return %d\n", dev->node->full_name, err);
1000 goto err; 998 goto err_no_irq;
1001 } 999 }
1002 } 1000 }
1003 1001
1004 err = fsl_dma_self_test(new_fsl_chan); 1002 err = fsl_dma_self_test(new_fsl_chan);
1005 if (err) 1003 if (err)
1006 goto err; 1004 goto err_self_test;
1007 1005
1008 dev_info(&dev->dev, "#%d (%s), irq %d\n", new_fsl_chan->id, 1006 dev_info(&dev->dev, "#%d (%s), irq %d\n", new_fsl_chan->id,
1009 match->compatible, new_fsl_chan->irq); 1007 match->compatible, new_fsl_chan->irq);
1010 1008
1011 return 0; 1009 return 0;
1012err: 1010
1013 dma_halt(new_fsl_chan); 1011err_self_test:
1014 iounmap(new_fsl_chan->reg_base);
1015 free_irq(new_fsl_chan->irq, new_fsl_chan); 1012 free_irq(new_fsl_chan->irq, new_fsl_chan);
1013err_no_irq:
1016 list_del(&new_fsl_chan->common.device_node); 1014 list_del(&new_fsl_chan->common.device_node);
1015err_no_chan:
1016 iounmap(new_fsl_chan->reg_base);
1017err_no_reg:
1017 kfree(new_fsl_chan); 1018 kfree(new_fsl_chan);
1018 return err; 1019 return err;
1019} 1020}
@@ -1054,8 +1055,7 @@ static int __devinit of_fsl_dma_probe(struct of_device *dev,
1054 fdev = kzalloc(sizeof(struct fsl_dma_device), GFP_KERNEL); 1055 fdev = kzalloc(sizeof(struct fsl_dma_device), GFP_KERNEL);
1055 if (!fdev) { 1056 if (!fdev) {
1056 dev_err(&dev->dev, "No enough memory for 'priv'\n"); 1057 dev_err(&dev->dev, "No enough memory for 'priv'\n");
1057 err = -ENOMEM; 1058 return -ENOMEM;
1058 goto err;
1059 } 1059 }
1060 fdev->dev = &dev->dev; 1060 fdev->dev = &dev->dev;
1061 INIT_LIST_HEAD(&fdev->common.channels); 1061 INIT_LIST_HEAD(&fdev->common.channels);
@@ -1065,7 +1065,7 @@ static int __devinit of_fsl_dma_probe(struct of_device *dev,
1065 if (err) { 1065 if (err) {
1066 dev_err(&dev->dev, "Can't get %s property 'reg'\n", 1066 dev_err(&dev->dev, "Can't get %s property 'reg'\n",
1067 dev->node->full_name); 1067 dev->node->full_name);
1068 goto err; 1068 goto err_no_reg;
1069 } 1069 }
1070 1070
1071 dev_info(&dev->dev, "Probe the Freescale DMA driver for %s " 1071 dev_info(&dev->dev, "Probe the Freescale DMA driver for %s "
@@ -1103,6 +1103,7 @@ static int __devinit of_fsl_dma_probe(struct of_device *dev,
1103 1103
1104err: 1104err:
1105 iounmap(fdev->reg_base); 1105 iounmap(fdev->reg_base);
1106err_no_reg:
1106 kfree(fdev); 1107 kfree(fdev);
1107 return err; 1108 return err;
1108} 1109}