drm/i915/selftests: Silence compiler warning in igt_ctx_exec
The compiler doesn't always spot the guard that object is allocated on
the first pass, leading to:
drivers/gpu/drm/i915/selftests/i915_gem_context.c: warning: 'obj' may be used uninitialized in this function [-Wuninitialized]: => 370:8
v2: Make it more obvious by setting obj to NULL on the first pass and
any later pass where we need to reallocate.
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Fixes: 791ff39ae3
("drm/i915: Live testing for context execution")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
c: <drm-intel-fixes@lists.freedesktop.org> # v4.12-rc1+
Link: http://patchwork.freedesktop.org/patch/msgid/20170523194412.1195-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
This commit is contained in:
parent
f63078abff
commit
ca83d5840c
|
@ -320,7 +320,7 @@ 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_i915_gem_object *obj;
|
struct drm_i915_gem_object *obj = NULL;
|
||||||
struct drm_file *file;
|
struct drm_file *file;
|
||||||
IGT_TIMEOUT(end_time);
|
IGT_TIMEOUT(end_time);
|
||||||
LIST_HEAD(objects);
|
LIST_HEAD(objects);
|
||||||
|
@ -359,7 +359,7 @@ static int igt_ctx_exec(void *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
for_each_engine(engine, i915, id) {
|
for_each_engine(engine, i915, id) {
|
||||||
if (dw == 0) {
|
if (!obj) {
|
||||||
obj = create_test_object(ctx, file, &objects);
|
obj = create_test_object(ctx, file, &objects);
|
||||||
if (IS_ERR(obj)) {
|
if (IS_ERR(obj)) {
|
||||||
err = PTR_ERR(obj);
|
err = PTR_ERR(obj);
|
||||||
|
@ -376,8 +376,10 @@ static int igt_ctx_exec(void *arg)
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++dw == max_dwords(obj))
|
if (++dw == max_dwords(obj)) {
|
||||||
|
obj = NULL;
|
||||||
dw = 0;
|
dw = 0;
|
||||||
|
}
|
||||||
ndwords++;
|
ndwords++;
|
||||||
}
|
}
|
||||||
ncontexts++;
|
ncontexts++;
|
||||||
|
|
Loading…
Reference in New Issue