Re: [PATCH 2/3] drm/amdgpu: Update ternary operator with max() in 'amdgpu_fence_wait_polling'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Am 16.08.23 um 08:18 schrieb Srinivasan Shanmugam:
Fixes the following coccicheck:

drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c:384:16-17: WARNING opportunity for max()

Cc: Christian König <christian.koenig@xxxxxxx>
Cc: Alex Deucher <alexander.deucher@xxxxxxx>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@xxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index c694b41f6461..cb0cb354208b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -381,7 +381,7 @@ signed long amdgpu_fence_wait_polling(struct amdgpu_ring *ring,
  		udelay(2);
  		timeout -= 2;
  	}
-	return timeout > 0 ? timeout : 0;
+	return max(timeout, (signed long)0);

This change will trigger a warning that you should use max_t here.

So either use max_t() or make the 0 a 0l (IIRC).

Regards,
Christian.

  }
  /**
   * amdgpu_fence_count_emitted - get the count of emitted fences




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux