AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Arnaud Bonnet" <abo@medichon.fr>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: fix string format compiler warning in jpeg_v2_5_sw_init
Date: Tue, 24 Nov 2026 08:59:25 +0000	[thread overview]
Message-ID: <sashiko-outbox-230768@kernel.org> (raw)
In-Reply-To: <20261123231150.26328-1-abo@medichon.fr>

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 <abo@medichon.fr>

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/20261123231150.26328-1-abo@medichon.fr?part=1

  reply	other threads:[~2026-11-24  8:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 23:11 [PATCH] drm/amdgpu: fix string format compiler warning in jpeg_v2_5_sw_init Arnaud Bonnet
2026-11-24  8:59 ` sashiko-bot [this message]
2026-11-25 16:11 ` [PATCH v2] " Arnaud Bonnet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-230768@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=abo@medichon.fr \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox