Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7dad9ef6 authored by Julia Lawall's avatar Julia Lawall Committed by Ben Skeggs
Browse files

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: default avatarJulia Lawall <julia@diku.dk>
Cc: David Airlie <airlied@linux.ie>
Cc: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent f0fbe3eb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;