Commit ef47a0e0 authored by Chris Wilson's avatar Chris Wilson

drm/i915/selftests: Catch error from mock_file()

The patch 791ff39a: "drm/i915: Live testing for context
execution" from Feb 13, 2017, leads to the following static checker
warning:

        drivers/gpu/drm/i915/selftests/i915_gem_context.c:347 igt_ctx_exec()
        error: 'file' dereferencing possible ERR_PTR()
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Fixes: 791ff39a ("drm/i915: Live testing for context execution")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: <drm-intel-fixes@lists.freedesktop.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170313124724.10614-1-chris@chris-wilson.co.ukReviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
parent 1257e0f8
...@@ -320,8 +320,8 @@ static unsigned long max_dwords(struct drm_i915_gem_object *obj) ...@@ -320,8 +320,8 @@ static unsigned long max_dwords(struct drm_i915_gem_object *obj)
static int igt_ctx_exec(void *arg) static int igt_ctx_exec(void *arg)
{ {
struct drm_i915_private *i915 = arg; struct drm_i915_private *i915 = arg;
struct drm_file *file = mock_file(i915);
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
struct drm_file *file;
IGT_TIMEOUT(end_time); IGT_TIMEOUT(end_time);
LIST_HEAD(objects); LIST_HEAD(objects);
unsigned long ncontexts, ndwords, dw; unsigned long ncontexts, ndwords, dw;
...@@ -333,6 +333,10 @@ static int igt_ctx_exec(void *arg) ...@@ -333,6 +333,10 @@ static int igt_ctx_exec(void *arg)
* up in the expected pages of our obj. * up in the expected pages of our obj.
*/ */
file = mock_file(i915);
if (IS_ERR(file))
return PTR_ERR(file);
mutex_lock(&i915->drm.struct_mutex); mutex_lock(&i915->drm.struct_mutex);
ncontexts = 0; ncontexts = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment