]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drm/nouveau/secboot: fix inconsistent pointer checking
authorAlexandre Courbot <acourbot@nvidia.com>
Wed, 15 Mar 2017 05:44:34 +0000 (14:44 +0900)
committerDave Airlie <airlied@redhat.com>
Fri, 17 Mar 2017 00:08:24 +0000 (10:08 +1000)
We were returning PTR_ERR() on a NULL pointer, which obviously won't
work. nvkm_engine_ref() will return an error in case something went
wrong.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp102.c

index 8570c84c8a297c78df081d2ca84ea06c9e92c200..f3b3c66349d201f1f7c61071201c1b71cb754787 100644 (file)
@@ -59,7 +59,8 @@ gp102_run_secure_scrub(struct nvkm_secboot *sb)
 
        nvkm_debug(subdev, "running VPR scrubber binary on NVDEC...\n");
 
-       if (!(engine = nvkm_engine_ref(&device->nvdec->engine)))
+       engine = nvkm_engine_ref(&device->nvdec->engine);
+       if (IS_ERR(engine))
                return PTR_ERR(engine);
        falcon = device->nvdec->falcon;