From: Alexandre Courbot Date: Wed, 15 Mar 2017 05:44:34 +0000 (+0900) Subject: drm/nouveau/secboot: fix inconsistent pointer checking X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=aa7fc0ca759eb25eea6dc0fee4373e5883a17498;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/nouveau/secboot: fix inconsistent pointer checking 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 Reported-by: Dan Carpenter Signed-off-by: Dave Airlie --- diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp102.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp102.c index 8570c84c8a29..f3b3c66349d2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp102.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp102.c @@ -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;