diff options
author | Julia Lawall <julia@diku.dk> | 2009-10-17 02:42:49 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2009-10-28 14:25:57 -0400 |
commit | 60e5c1b5ecd99e06d3133a2a20d58d3c2b9968ac (patch) | |
tree | 84a2faad185d03646999895ed4d074c7ada03fd7 /arch/arm | |
parent | d3bf3956c75b38def079fb6db40b5cf3f1466a93 (diff) |
ARM: S3C24XX: arch/arm/plat-s3c24xx: Move dereference after NULL test
If the NULL test on buf is needed, then the dereference should be after the
NULL test.
A simplified version of the semantic match that detects this problem is as
follows (http://coccinelle.lip6.fr/):
// <smpl>
@match exists@
expression x, E;
identifier fld;
@@
* x->fld
... when != \(x = E\|&x\)
* x == NULL
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/plat-s3c24xx/dma.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c index 196b19123653..f046f8c51084 100644 --- a/arch/arm/plat-s3c24xx/dma.c +++ b/arch/arm/plat-s3c24xx/dma.c | |||
@@ -208,14 +208,14 @@ s3c2410_dma_loadbuffer(struct s3c2410_dma_chan *chan, | |||
208 | { | 208 | { |
209 | unsigned long reload; | 209 | unsigned long reload; |
210 | 210 | ||
211 | pr_debug("s3c2410_chan_loadbuffer: loading buff %p (0x%08lx,0x%06x)\n", | ||
212 | buf, (unsigned long)buf->data, buf->size); | ||
213 | |||
214 | if (buf == NULL) { | 211 | if (buf == NULL) { |
215 | dmawarn("buffer is NULL\n"); | 212 | dmawarn("buffer is NULL\n"); |
216 | return -EINVAL; | 213 | return -EINVAL; |
217 | } | 214 | } |
218 | 215 | ||
216 | pr_debug("s3c2410_chan_loadbuffer: loading buff %p (0x%08lx,0x%06x)\n", | ||
217 | buf, (unsigned long)buf->data, buf->size); | ||
218 | |||
219 | /* check the state of the channel before we do anything */ | 219 | /* check the state of the channel before we do anything */ |
220 | 220 | ||
221 | if (chan->load_state == S3C2410_DMALOAD_1LOADED) { | 221 | if (chan->load_state == S3C2410_DMALOAD_1LOADED) { |