]> git.hungrycats.org Git - linux/commitdiff
drm/amd/display: Fix sign mismatch warning
authorGeorge Zhang <george.zhang@amd.com>
Fri, 3 Jul 2026 13:44:45 +0000 (09:44 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 8 Jul 2026 18:20:30 +0000 (14:20 -0400)
Using mismatched signedness (int and uint32_t) causes a -Wsign-compare
warning. Fix it by changing the min macro to min_t to explicitly cast.

Fixes: 8cbe3648aa86 ("drm/amd/display: clamp DMUB AUX reply length to payload buffer")
Signed-off-by: George Zhang <george.zhang@amd.com>
Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c

index 0aa99d1a542f3399f5faf02fd1bf57a78c81fedb..2692d1890ba2d6746a6ae5a39e0e827c7b679c47 100644 (file)
@@ -799,8 +799,8 @@ int amdgpu_dm_process_dmub_aux_transfer_sync(
        /*write req may receive a byte indicating partially written number as well*/
        if (p_notify->aux_reply.length && payload->data) {
                /* Bound the reply to the scratch buffer it was read into. */
-               ret = min((uint32_t)p_notify->aux_reply.length,
-                         (uint32_t)sizeof(p_notify->aux_reply.data));
+               ret = min_t(uint32_t, p_notify->aux_reply.length,
+                           sizeof(p_notify->aux_reply.data));
 
                /*
                 * During a write-status-update retry the caller zeroes
@@ -809,7 +809,7 @@ int amdgpu_dm_process_dmub_aux_transfer_sync(
                 * so only clamp to payload->length for regular transfers.
                 */
                if (!payload->write_status_update)
-                       ret = min(ret, payload->length);
+                       ret = min_t(int, ret, payload->length);
 
                memcpy(payload->data, p_notify->aux_reply.data, ret);
        } else {