• Srinivasan Shanmugam's avatar
    drm/amdgpu: Fix type mismatch in amdgpu_gfx_kiq_init_ring · 745f7170
    Srinivasan Shanmugam authored
    This commit fixes a type mismatch in the amdgpu_gfx_kiq_init_ring
    function triggered by the snprintf function expecting unsigned char
    arguments due to the '%hhu' format specifier, but receiving int and u32
    arguments.
    
    The issue occurred because the arguments xcc_id, ring->me, ring->pipe,
    and ring->queue were of type int and u32, not unsigned char. This led to
    a type mismatch when these arguments were passed to snprintf.
    
    To resolve this, the snprintf line was modified to cast these arguments
    to unsigned char. This ensures that the arguments are of the correct
    type for the '%hhu' format specifier and resolves the warning.
    
    Fixes the below:
    >> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:333:4: warning: format
    >> specifies type 'unsigned char' but the argument has type 'int'
    >> [-Wformat]
                        xcc_id, ring->me, ring->pipe, ring->queue);
                        ^~~~~~
    >> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:333:12: warning: format
    >> specifies type 'unsigned char' but the argument has type 'u32' (aka
    >> 'unsigned int') [-Wformat]
                        xcc_id, ring->me, ring->pipe, ring->queue);
                                ^~~~~~~~
       drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:333:22: warning: format specifies type 'unsigned char' but the argument has type 'u32' (aka 'unsigned int') [-Wformat]
                        xcc_id, ring->me, ring->pipe, ring->queue);
                                          ^~~~~~~~~~
       drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:333:34: warning: format specifies type 'unsigned char' but the argument has type 'u32' (aka 'unsigned int') [-Wformat]
                        xcc_id, ring->me, ring->pipe, ring->queue);
                                                      ^~~~~~~~~~~
       4 warnings generated.
    
    Fixes: 0ea55445 ("drm/amdgpu: Fix snprintf usage in amdgpu_gfx_kiq_init_ring")
    Reported-by: default avatarkernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202405250446.XeaWe66u-lkp@intel.com/
    Cc: Lijo Lazar <lijo.lazar@amd.com>
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: Christian König <christian.koenig@amd.com>
    Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
    Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    745f7170
amdgpu_gfx.c 38.2 KB