Skip to content

Commit

Permalink
drivers/gpu/drm/nouveau/nouveau_grctx.c: correct NULL test
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Julia Lawall authored and Ben Skeggs committed Feb 9, 2010
1 parent f0fbe3e commit 7dad9ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/nouveau/nouveau_grctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ nouveau_grctx_prog_load(struct drm_device *dev)
}

pgraph->ctxvals = kmalloc(fw->size, GFP_KERNEL);
if (!pgraph->ctxprog) {
NV_ERROR(dev, "OOM copying ctxprog\n");
if (!pgraph->ctxvals) {
NV_ERROR(dev, "OOM copying ctxvals\n");
release_firmware(fw);
nouveau_grctx_fini(dev);
return -ENOMEM;
Expand Down

0 comments on commit 7dad9ef

Please sign in to comment.