Linux Tegra architecture development
 help / color / mirror / Atom feed
From: Mikko Perttunen <mperttunen@nvidia.com>
To: linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Brahmajit Das <listout@listout.xyz>
Cc: thierry.reding@gmail.com, airlied@gmail.com, simona@ffwll.ch,
	jonathanh@nvidia.com
Subject: Re: [PATCH] drm/tegra: hdmi: sor: Fix error: variable ‘j’ set but not used
Date: Wed, 17 Sep 2025 12:53:55 +0900	[thread overview]
Message-ID: <6392398.DvuYhMxLoT@senjougahara> (raw)
In-Reply-To: <20250901212020.3757519-1-listout@listout.xyz>

On Tuesday, September 2, 2025 6:20 AM Brahmajit Das wrote:
> The variable j is set, however never used in or outside the loop, thus
> resulting in dead code.
> Building with GCC 16 results in a build error due to
> -Werror=unused-but-set-variable= enabled by default.
> This patch clean up the dead code and fixes the build error.
> 
> Example build log:
> drivers/gpu/drm/tegra/sor.c:1867:19: error: variable ‘j’ set but not used [-Werror=unused-but-set-variable=]
>  1867 |         size_t i, j;
>       |                   ^
> 
> Signed-off-by: Brahmajit Das <listout@listout.xyz>
> ---
>  drivers/gpu/drm/tegra/hdmi.c | 4 ++--
>  drivers/gpu/drm/tegra/sor.c  | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
> index 8cd2969e7d4b..c4820f5e7658 100644
> --- a/drivers/gpu/drm/tegra/hdmi.c
> +++ b/drivers/gpu/drm/tegra/hdmi.c
> @@ -658,7 +658,7 @@ static void tegra_hdmi_write_infopack(struct tegra_hdmi *hdmi, const void *data,
>  {
>  	const u8 *ptr = data;
>  	unsigned long offset;
> -	size_t i, j;
> +	size_t i;
>  	u32 value;
>  
>  	switch (ptr[0]) {
> @@ -691,7 +691,7 @@ static void tegra_hdmi_write_infopack(struct tegra_hdmi *hdmi, const void *data,
>  	 * - subpack_low: bytes 0 - 3
>  	 * - subpack_high: bytes 4 - 6 (with byte 7 padded to 0x00)
>  	 */
> -	for (i = 3, j = 0; i < size; i += 7, j += 8) {
> +	for (i = 3; i < size; i += 7) {
>  		size_t rem = size - i, num = min_t(size_t, rem, 4);
>  
>  		value = tegra_hdmi_subpack(&ptr[i], num);
> diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
> index 21f3dfdcc5c9..bc7dd562cf6b 100644
> --- a/drivers/gpu/drm/tegra/sor.c
> +++ b/drivers/gpu/drm/tegra/sor.c
> @@ -1864,7 +1864,7 @@ static void tegra_sor_hdmi_write_infopack(struct tegra_sor *sor,
>  {
>  	const u8 *ptr = data;
>  	unsigned long offset;
> -	size_t i, j;
> +	size_t i;
>  	u32 value;
>  
>  	switch (ptr[0]) {
> @@ -1897,7 +1897,7 @@ static void tegra_sor_hdmi_write_infopack(struct tegra_sor *sor,
>  	 * - subpack_low: bytes 0 - 3
>  	 * - subpack_high: bytes 4 - 6 (with byte 7 padded to 0x00)
>  	 */
> -	for (i = 3, j = 0; i < size; i += 7, j += 8) {
> +	for (i = 3; i < size; i += 7) {
>  		size_t rem = size - i, num = min_t(size_t, rem, 4);
>  
>  		value = tegra_sor_hdmi_subpack(&ptr[i], num);
> 

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>




      reply	other threads:[~2025-09-17  3:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01 21:20 [PATCH] drm/tegra: hdmi: sor: Fix error: variable ‘j’ set but not used Brahmajit Das
2025-09-17  3:53 ` Mikko Perttunen [this message]

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=6392398.DvuYhMxLoT@senjougahara \
    --to=mperttunen@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-tegra@vger.kernel.org \
    --cc=listout@listout.xyz \
    --cc=simona@ffwll.ch \
    --cc=thierry.reding@gmail.com \
    /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