Skip to content

Commit 42de9b0

Browse files
sudeep-hollajnikula
authored andcommitted
drm/i915/selftests: Fix compare functions provided for sorting
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 <[email protected]> Cc: Mika Kuoppala <[email protected]> Signed-off-by: Sudeep Holla <[email protected]> Reviewed-by: Chris Wilson <[email protected]> Signed-off-by: Chris Wilson <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 2196dfe) Signed-off-by: Jani Nikula <[email protected]>
1 parent 11ba468 commit 42de9b0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/gpu/drm/i915/gt/selftest_rps.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ static int cmp_u64(const void *A, const void *B)
4444
{
4545
const u64 *a = A, *b = B;
4646

47-
if (a < b)
47+
if (*a < *b)
4848
return -1;
49-
else if (a > b)
49+
else if (*a > *b)
5050
return 1;
5151
else
5252
return 0;
@@ -56,9 +56,9 @@ static int cmp_u32(const void *A, const void *B)
5656
{
5757
const u32 *a = A, *b = B;
5858

59-
if (a < b)
59+
if (*a < *b)
6060
return -1;
61-
else if (a > b)
61+
else if (*a > *b)
6262
return 1;
6363
else
6464
return 0;

0 commit comments

Comments
 (0)