]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
arch/arm/plat-pxa/dma.c: correct NULL test
authorJulia Lawall <julia@diku.dk>
Tue, 27 Apr 2010 21:09:11 +0000 (14:09 -0700)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 1 May 2010 10:33:00 +0000 (11:33 +0100)
Test the just-allocated value for NULL rather than some other value.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,y;
statement S;
@@

x = \(kmalloc\|kcalloc\|kzalloc\)(...);
(
if ((x) == NULL) S
|
if (
-   y
+   x
       == NULL)
 S
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/plat-pxa/dma.c

index 742350e0f2a77813651474815cd1f70bd09d46f2..2d3c19d7c7b1cd69a29c1796a913ee6e5a681c0c 100644 (file)
@@ -245,7 +245,7 @@ static void pxa_dma_init_debugfs(void)
 
        dbgfs_chan = kmalloc(sizeof(*dbgfs_state) * num_dma_channels,
                             GFP_KERNEL);
-       if (!dbgfs_state)
+       if (!dbgfs_chan)
                goto err_alloc;
 
        chandir = debugfs_create_dir("channels", dbgfs_root);