On 12/18/25 16:04, Tvrtko Ursulin wrote:
> Sort function only cares about the sign so we can replace the conditionals
> with a single subtraction.
> 
> Signed-off-by: Tvrtko Ursulin <[email protected]>

Reviewed-by: Christian König <[email protected]>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
> index 0ab307317145..16b647b42b0a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
> @@ -60,11 +60,9 @@ static int amdgpu_bo_list_entry_cmp(const void *_a, const 
> void *_b)
>  {
>       const struct amdgpu_bo_list_entry *a = _a, *b = _b;
>  
> -     if (a->priority > b->priority)
> -             return 1;
> -     if (a->priority < b->priority)
> -             return -1;
> -     return 0;
> +     BUILD_BUG_ON(AMDGPU_BO_LIST_MAX_PRIORITY >= INT_MAX);
> +
> +     return (int)a->priority - (int)b->priority;
>  }
>  
>  struct amdgpu_bo_list *

Reply via email to