Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/amdgpu: snprintf() %hd type mismatch with int i in
  jpeg_v2_5_sw_init()
--

commit bb4e12d069d5e73451e34365a02677da5fad2d5f
Author: Arnaud Bonnet <[email protected]>

drm/amdgpu: fix string format compiler warning in jpeg_v2_5_sw_init

This commit changes the snprintf() format specifier for the JPEG ring name
in jpeg_v2_5_sw_init() from %d to %hd to silence a GCC -Wformat-truncation
warning.

> diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c 
> b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c
> index 966a8a7f28eed..e2ba58cbff5cb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c
> +++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c
> @@ -149,7 +149,7 @@ static int jpeg_v2_5_sw_init(struct amdgpu_ip_block 
> *ip_block)
>               else
>                       ring->vm_hub = AMDGPU_MMHUB0(0);
>               ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 
> 1) + 1 + 8 * i;
> -             snprintf(ring->name, sizeof(ring->name), "jpeg_dec_%d", i);
> +             snprintf(ring->name, sizeof(ring->name), "jpeg_dec_%hd", i);

[Severity: Medium]
Does passing int i to %hd introduce a -Wformat warning when building with
Clang?

In jpeg_v2_5_sw_init(), i is declared as int, so Clang warns that the
format specifies type short while the argument has type int, breaking
builds with CONFIG_DRM_AMDGPU_WERROR=y or CONFIG_WERROR=y.  Declaring i as
unsigned int and using %u avoids both the GCC truncation warning and the
Clang type mismatch.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to