aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-pxa
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2010-03-22 04:11:55 -0400
committerEric Miao <eric.y.miao@gmail.com>2010-05-11 11:24:59 -0400
commit077de1ad5ad8b4e08fd8853ae7e4cc628c1a369b (patch)
treeddb1add4424010444d98d497b3a801627722e42e /arch/arm/plat-pxa
parent07871c195a5ec7d59d34994c123472b113da09ba (diff)
[ARM] pxa: avoid NULL dereferencing in error handling of ssp.c
The assignments of res to the results of the two calls to platform_get_resource make it impossible to use res in the error handling code in the arguments to release_mem_region. The semantic match that finds the former problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r exists@ expression E, E1; identifier f; statement S1,S3; iterator iter; @@ if ((E == NULL && ...) || ...) { ... when != false ((E == NULL && ...) || ...) when != true ((E != NULL && ...) || ...) when != iter(E,...) S1 when != E = E1 ( sizeof(E->f) | * E->f ) ... when any return ...; } else S3 // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm/plat-pxa')
-rw-r--r--arch/arm/plat-pxa/ssp.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c
index cfebcd836f3e..3bf704d7a0d6 100644
--- a/arch/arm/plat-pxa/ssp.c
+++ b/arch/arm/plat-pxa/ssp.c
@@ -92,6 +92,22 @@ static int __devinit ssp_probe(struct platform_device *pdev)
92 goto err_free; 92 goto err_free;
93 } 93 }
94 94
95 res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
96 if (res == NULL) {
97 dev_err(&pdev->dev, "no SSP RX DRCMR defined\n");
98 ret = -ENODEV;
99 goto err_free_clk;
100 }
101 ssp->drcmr_rx = res->start;
102
103 res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
104 if (res == NULL) {
105 dev_err(&pdev->dev, "no SSP TX DRCMR defined\n");
106 ret = -ENODEV;
107 goto err_free_clk;
108 }
109 ssp->drcmr_tx = res->start;
110
95 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 111 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
96 if (res == NULL) { 112 if (res == NULL) {
97 dev_err(&pdev->dev, "no memory resource defined\n"); 113 dev_err(&pdev->dev, "no memory resource defined\n");
@@ -123,22 +139,6 @@ static int __devinit ssp_probe(struct platform_device *pdev)
123 goto err_free_io; 139 goto err_free_io;
124 } 140 }
125 141
126 res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
127 if (res == NULL) {
128 dev_err(&pdev->dev, "no SSP RX DRCMR defined\n");
129 ret = -ENODEV;
130 goto err_free_io;
131 }
132 ssp->drcmr_rx = res->start;
133
134 res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
135 if (res == NULL) {
136 dev_err(&pdev->dev, "no SSP TX DRCMR defined\n");
137 ret = -ENODEV;
138 goto err_free_io;
139 }
140 ssp->drcmr_tx = res->start;
141
142 /* PXA2xx/3xx SSP ports starts from 1 and the internal pdev->id 142 /* PXA2xx/3xx SSP ports starts from 1 and the internal pdev->id
143 * starts from 0, do a translation here 143 * starts from 0, do a translation here
144 */ 144 */