Re: [PATCH] usb: gadget: configfs: Fix set but not used variable warning

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

 



On Thu, Feb 09, 2023 at 09:43:59AM +0000, Daniel Scally wrote:
> Fix a -Wunused-but-set-variable warning in gadget_string_s_store()

A side comment below.

...

>  	if (len > USB_MAX_STRING_LEN)
>  		return -EINVAL;
>  
> -	ret = strscpy(string->string, page, size);
> -	return len;
> +	return strscpy(string->string, page, size);

Do you need above check with strscpy()? You may supply the maximum length
and negative error code from the strscpy() will indicate the cut.

-- 
With Best Regards,
Andy Shevchenko





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

  Powered by Linux