Skip to content

Commit

Permalink
drm/amd/display: use swap() in sort()
Browse files Browse the repository at this point in the history
Use existing swap() function rather than duplicating its implementation.

./drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn3.c:17:29-30: WARNING opportunity for swap().

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9573
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Jiapeng Chong authored and Alex Deucher committed Jul 25, 2024
1 parent fdedd77 commit f3c681f
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@

static void sort(double *list_a, int list_a_size)
{
double temp;
// For all elements b[i] in list_b[]
for (int i = 0; i < list_a_size - 1; i++) {
// Find the first element of list_a that's larger than b[i]
for (int j = i; j < list_a_size - 1; j++) {
if (list_a[j] > list_a[j + 1]) {
temp = list_a[j];
list_a[j] = list_a[j + 1];
list_a[j + 1] = temp;
}
if (list_a[j] > list_a[j + 1])
swap(list_a[j], list_a[j + 1]);
}
}
}
Expand Down

0 comments on commit f3c681f

Please sign in to comment.