Re: [PATCH v3 1/4] usb: gadget: f_mass_storage: fix warning of -Werror=unused-but-set-variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 09, 2022 at 07:54:45PM +0800, Linyu Yuan wrote:
> When add gcc W=1 compile flag, it report following error,
> In function 'invalidate_sub':
> error: variable 'rc' set but not used [-Werror=unused-but-set-variable],
> 
> Add a __maybe_unused property.
> 
> Signed-off-by: Linyu Yuan <quic_linyyuan@xxxxxxxxxxx>
> ---
> v3: new add
> 
>  drivers/usb/gadget/function/f_mass_storage.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
> index 3a77bca..a688538 100644
> --- a/drivers/usb/gadget/function/f_mass_storage.c
> +++ b/drivers/usb/gadget/function/f_mass_storage.c
> @@ -926,7 +926,7 @@ static void invalidate_sub(struct fsg_lun *curlun)
>  {
>  	struct file	*filp = curlun->filp;
>  	struct inode	*inode = file_inode(filp);
> -	unsigned long	rc;
> +	unsigned long	__maybe_unused rc;

That is almost never the correct solution here, sorry.  Fix this up
properly.

And W=1 really is not a valid thing to care about, right?

thanks,

>  	rc = invalidate_mapping_pages(inode->i_mapping, 0, -1);

Why not properly handle the error?

thanks,

greg k-h



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux