[Intel-gfx] [PATCH] drm/i915/selftests: Don't dereference an error pointer
Dan Carpenter
dan.carpenter at oracle.com
Wed Jun 20 11:09:11 UTC 2018
There is an error path where "ctx" is an error pointer so we can't
pass it to kernel_context_close().
Fixes: 09a4c02e58c1 ("drm/i915: Look for an active kernel context before switching")
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
index 836f1af8b833..e41036fcd97e 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
@@ -541,7 +541,8 @@ static int igt_switch_to_kernel_context(void *arg)
err = -EIO;
mutex_unlock(&i915->drm.struct_mutex);
- kernel_context_close(ctx);
+ if (!IS_ERR(ctx))
+ kernel_context_close(ctx);
return err;
}
More information about the Intel-gfx
mailing list