Skip to content

Commit b828e10

Browse files
srishanmalexdeucher
authored andcommitted
drm/amdgpu: Replace ternary operator with min() in 'amdgpu_iomem_write'
Fixes the following coccicheck: drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2482:16-17: WARNING opportunity for min() min() macro is defined in include/linux/minmax.h. It avoids multiple evaluations of the arguments when non-constant and performs strict type-checking. Cc: Guchun Chen <guchun.chen@amd.com> Cc: Christian König <christian.koenig@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 1347b15 commit b828e10

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2474,7 +2474,7 @@ static ssize_t amdgpu_iomem_write(struct file *f, const char __user *buf,
24742474
struct page *p;
24752475
void *ptr;
24762476

2477-
bytes = bytes < size ? bytes : size;
2477+
bytes = min(bytes, size);
24782478

24792479
addr = dom ? iommu_iova_to_phys(dom, addr) : addr;
24802480

0 commit comments

Comments
 (0)