Commit 1805ec67 authored by Colin Ian King's avatar Colin Ian King Committed by Chris Wilson

drm/i915/selftests: fix uninitialized variable sum when summing up values

Currently the variable sum is not uninitialized and hence will cause an
incorrect result in the summation values.  Fix this by initializing
sum to the first item in the summation.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: 3c7a44bb ("drm/i915/selftests: Perform some basic cycle counting of MI ops")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20191210143205.338308-1-colin.king@canonical.com
parent 82c69bf5
...@@ -108,7 +108,7 @@ static u32 trifilter(u32 *a) ...@@ -108,7 +108,7 @@ static u32 trifilter(u32 *a)
sort(a, COUNT, sizeof(*a), cmp_u32, NULL); sort(a, COUNT, sizeof(*a), cmp_u32, NULL);
sum += mul_u32_u32(a[2], 2); sum = mul_u32_u32(a[2], 2);
sum += a[1]; sum += a[1];
sum += a[3]; sum += a[3];
......
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