Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Tom Rix <trix@redhat.com>, Zhou jie <zhoujie@nfschina.com>,
	llvm@lists.linux.dev
Subject: Re: [PATCH] media: wl128x: fix a clang warning
Date: Fri, 30 Jun 2023 08:54:27 -0700	[thread overview]
Message-ID: <20230630155427.GA2889176@dev-arch.thelio-3990X> (raw)
In-Reply-To: <6badd27ebfa718d5737f517f18b29a3e0f6e43f8.1687981726.git.mchehab@kernel.org>

On Wed, Jun 28, 2023 at 09:48:53PM +0200, Mauro Carvalho Chehab wrote:
> Clang-16 produces this warning, which is fatal with CONFIG_WERROR:
> 
> 	../drivers/media/radio/wl128x/fmdrv_common.c:1237:19: error: variable 'cmd_cnt' set but not used [-Werror,-Wunused-but-set-variable]
> 	        int ret, fw_len, cmd_cnt;
> 	                         ^
> 	1 error generated.
> 
> What happens is that cmd_cnt tracks the amount of firmware data packets
> were transfered, which is printed only when debug is used.

Alternatively, fmdbg() could be defined with no_printk(), so that the
variable appears used in all configurations, but this does not seem
unreasonable either.

> Switch to use the firmware count, as the message is all about reporting
> a partial firmware transfer.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
> ---
>  drivers/media/radio/wl128x/fmdrv_common.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c
> index cbd49dff6d74..b31b7ed60bbe 100644
> --- a/drivers/media/radio/wl128x/fmdrv_common.c
> +++ b/drivers/media/radio/wl128x/fmdrv_common.c
> @@ -1234,9 +1234,8 @@ static int fm_download_firmware(struct fmdev *fmdev, const u8 *fw_name)
>  	struct bts_action *action;
>  	struct bts_action_delay *delay;
>  	u8 *fw_data;
> -	int ret, fw_len, cmd_cnt;
> +	int ret, fw_len;
>  
> -	cmd_cnt = 0;
>  	set_bit(FM_FW_DW_INPROGRESS, &fmdev->flag);
>  
>  	ret = request_firmware(&fw_entry, fw_name,
> @@ -1272,7 +1271,6 @@ static int fm_download_firmware(struct fmdev *fmdev, const u8 *fw_name)
>  			if (ret)
>  				goto rel_fw;
>  
> -			cmd_cnt++;
>  			break;
>  
>  		case ACTION_DELAY:	/* Delay */
> @@ -1284,7 +1282,7 @@ static int fm_download_firmware(struct fmdev *fmdev, const u8 *fw_name)
>  		fw_data += (sizeof(struct bts_action) + (action->size));
>  		fw_len -= (sizeof(struct bts_action) + (action->size));
>  	}
> -	fmdbg("Firmware commands(%d) loaded to chip\n", cmd_cnt);
> +	fmdbg("Transfered only %d of %d bytes of the firmware to chip\n", fw_entry->size - fw_len, fw_entry->size);
>  rel_fw:
>  	release_firmware(fw_entry);
>  	clear_bit(FM_FW_DW_INPROGRESS, &fmdev->flag);
> -- 
> 2.41.0
> 

      reply	other threads:[~2023-06-30 15:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28 19:48 [PATCH] media: wl128x: fix a clang warning Mauro Carvalho Chehab
2023-06-30 15:54 ` Nathan Chancellor [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=20230630155427.GA2889176@dev-arch.thelio-3990X \
    --to=nathan@kernel.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=trix@redhat.com \
    --cc=zhoujie@nfschina.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