Skip to content

Commit

Permalink
drm/i915/selftests: Fix compare functions provided for sorting
Browse files Browse the repository at this point in the history
Both cmp_u32 and cmp_u64 are comparing the pointers instead of the value
at those pointers. This will result in incorrect/unsorted list. Fix it
by deferencing the pointers before comparison.

Fixes: 4ba74e5 ("drm/i915/selftests: Verify frequency scaling with RPS")
Fixes: 8757797 ("drm/i915/selftests: Repeat the rps clock frequency measurement")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20200709154931.23310-1-sudeep.holla@arm.com
(cherry picked from commit 2196dfe)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
  • Loading branch information
Sudeep Holla authored and Jani Nikula committed Jul 14, 2020
1 parent 11ba468 commit 42de9b0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/gpu/drm/i915/gt/selftest_rps.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ static int cmp_u64(const void *A, const void *B)
{
const u64 *a = A, *b = B;

if (a < b)
if (*a < *b)
return -1;
else if (a > b)
else if (*a > *b)
return 1;
else
return 0;
Expand All @@ -56,9 +56,9 @@ static int cmp_u32(const void *A, const void *B)
{
const u32 *a = A, *b = B;

if (a < b)
if (*a < *b)
return -1;
else if (a > b)
else if (*a > *b)
return 1;
else
return 0;
Expand Down

0 comments on commit 42de9b0

Please sign in to comment.