]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/i915/selftests: Always initialise err
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 14 Nov 2017 22:33:46 +0000 (22:33 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 14 Nov 2017 23:50:49 +0000 (23:50 +0000)
smatch does not track initialised values as well as gcc, and this
triggers many warnings by smatch not presented by gcc. Silence smatch by
initialising the error values to -ENODEV, which we use to denote
internal errors. (If we see a selftest fail with a silent -ENODEV, we
know smatch was right!)

v2: smatch was right about igt_create_vma(), it may unlikely fail on the
first object allocation which we want to be loud about.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20171114223346.25958-1-chris@chris-wilson.co.uk
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
drivers/gpu/drm/i915/selftests/i915_gem_context.c
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
drivers/gpu/drm/i915/selftests/i915_gem_request.c
drivers/gpu/drm/i915/selftests/i915_gem_timeline.c
drivers/gpu/drm/i915/selftests/i915_syncmap.c
drivers/gpu/drm/i915/selftests/i915_vma.c

index def5052862aecd1fb7dc05e7722520764aaaaf70..c82780a9d455652e1b06bfae0635b711fcb90935 100644 (file)
@@ -325,7 +325,7 @@ static int igt_ctx_exec(void *arg)
        LIST_HEAD(objects);
        unsigned long ncontexts, ndwords, dw;
        bool first_shared_gtt = true;
-       int err;
+       int err = -ENODEV;
 
        /* Create a few different contexts (with different mm) and write
         * through each ctx/mm using the GPU making sure those writes end
index 581296860539235aa70a1a3f420cf3f37e93cf99..d9560d8a6cc879a9f6ddf80c73db137334bf22d1 100644 (file)
@@ -699,7 +699,7 @@ static int drunk_hole(struct drm_i915_private *i915,
                unsigned int *order, count, n;
                struct i915_vma *vma;
                u64 hole_size;
-               int err;
+               int err = -ENODEV;
 
                hole_size = (hole_end - hole_start) >> size;
                if (hole_size > KMALLOC_MAX_SIZE / sizeof(u32))
@@ -958,7 +958,7 @@ static int exercise_ggtt(struct drm_i915_private *i915,
        u64 hole_start, hole_end, last = 0;
        struct drm_mm_node *node;
        IGT_TIMEOUT(end_time);
-       int err;
+       int err = -ENODEV;
 
        mutex_lock(&i915->drm.struct_mutex);
 restart:
@@ -1164,7 +1164,7 @@ static int igt_gtt_reserve(void *arg)
        struct drm_i915_gem_object *obj, *on;
        LIST_HEAD(objects);
        u64 total;
-       int err;
+       int err = -ENODEV;
 
        /* i915_gem_gtt_reserve() tries to reserve the precise range
         * for the node, and evicts if it has to. So our test checks that
@@ -1355,7 +1355,7 @@ static int igt_gtt_insert(void *arg)
        }, *ii;
        LIST_HEAD(objects);
        u64 total;
-       int err;
+       int err = -ENODEV;
 
        /* i915_gem_gtt_insert() tries to allocate some free space in the GTT
         * to the node, evicting if required.
index a999161e8db1ea576ee00b3447aa8e424a405b1c..6bce99050e947ad52fe24110f7fdf579c073b79c 100644 (file)
@@ -332,7 +332,7 @@ static int live_nop_request(void *arg)
        struct intel_engine_cs *engine;
        struct live_test t;
        unsigned int id;
-       int err;
+       int err = -ENODEV;
 
        /* Submit various sized batches of empty requests, to each engine
         * (individually), and wait for the batch to complete. We can check
index 4795877abe5611876c7a3fe0f4401cd10b0e4bfe..3000e6a7d82d3f4cc6c6c554548375abeff9b138 100644 (file)
@@ -79,7 +79,7 @@ static int igt_sync(void *arg)
        }, *p;
        struct intel_timeline *tl;
        int order, offset;
-       int ret;
+       int ret = -ENODEV;
 
        tl = mock_timeline(0);
        if (!tl)
index bcab3d00a78596f7f0a156d097cd59a382c642f5..47f4ae18a1ef04c9a4f44bcd8cae1eeaf6999d1f 100644 (file)
@@ -333,7 +333,7 @@ static int igt_syncmap_join_below(void *arg)
 {
        struct i915_syncmap *sync;
        unsigned int step, order, idx;
-       int err;
+       int err = -ENODEV;
 
        i915_syncmap_init(&sync);
 
@@ -402,7 +402,7 @@ static int igt_syncmap_neighbours(void *arg)
        I915_RND_STATE(prng);
        IGT_TIMEOUT(end_time);
        struct i915_syncmap *sync;
-       int err;
+       int err = -ENODEV;
 
        /*
         * Each leaf holds KSYNCMAP seqno. Check that when we create KSYNCMAP
@@ -447,7 +447,7 @@ static int igt_syncmap_compact(void *arg)
 {
        struct i915_syncmap *sync;
        unsigned int idx, order;
-       int err;
+       int err = -ENODEV;
 
        i915_syncmap_init(&sync);
 
index 2e86ec136b3558ba019e3b67e66b127f0a056879..eb89e301b602fcbec78146662994a8ab37cf34ea 100644 (file)
@@ -150,7 +150,7 @@ static int igt_vma_create(void *arg)
        IGT_TIMEOUT(end_time);
        LIST_HEAD(contexts);
        LIST_HEAD(objects);
-       int err;
+       int err = -ENOMEM;
 
        /* Exercise creating many vma amonst many objections, checking the
         * vma creation and lookup routines.