OSDN Git Service

drm/i915: Silence compiler for GTT selftests
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 14 Feb 2017 11:37:56 +0000 (11:37 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 14 Feb 2017 22:30:21 +0000 (22:30 +0000)
gcc-4.7 spotted that

In file included from drivers/gpu/drm/i915/i915_gem_gtt.c:3791:0:
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c: In function ‘pot_hole’:
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c:594:6: error: ‘err’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

So set it to 0 should we ever skip over a hole smaller than a few pages.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170214113756.27834-1-chris@chris-wilson.co.uk
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c

index 468f099..320c687 100644 (file)
@@ -591,7 +591,7 @@ static int pot_hole(struct drm_i915_private *i915,
        struct i915_vma *vma;
        unsigned long flags;
        unsigned int pot;
-       int err;
+       int err = 0;
 
        flags = PIN_OFFSET_FIXED | PIN_USER;
        if (i915_is_ggtt(vm))