drivers/gpu/drm/nouveau/nouveau_grctx.c: correct NULL test
authorJulia Lawall <julia@diku.dk>
Tue, 2 Feb 2010 22:40:30 +0000 (14:40 -0800)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 9 Feb 2010 02:49:55 +0000 (12:49 +1000)
commit7dad9ef6d9255b4d2d0a26305a785a55f3ba55e3
tree33f83c024e834dc26f47db4cbea0224342244f26
parentf0fbe3eb5f65fe5948219f4ceac68f8a665b1fc6
drivers/gpu/drm/nouveau/nouveau_grctx.c: correct NULL test

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: David Airlie <airlied@linux.ie>
Cc: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_grctx.c