usb: gadget: configfs: Fix set but not used variable warning

Fix a -Wunused-but-set-variable warning in gadget_string_s_store()

Fixes: 15a7cf8caa ("usb: gadget: configfs: Support arbitrary string descriptors")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Link: https://lore.kernel.org/r/20230209094359.1549629-1-dan.scally@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Daniel Scally 2023-02-09 09:43:59 +00:00 committed by Greg Kroah-Hartman
parent 88e054e8df
commit 8488a831e0
1 changed files with 1 additions and 3 deletions

View File

@ -821,13 +821,11 @@ static ssize_t gadget_string_s_store(struct config_item *item, const char *page,
{ {
struct gadget_string *string = to_gadget_string(item); struct gadget_string *string = to_gadget_string(item);
int size = min(sizeof(string->string), len + 1); int size = min(sizeof(string->string), len + 1);
int ret;
if (len > USB_MAX_STRING_LEN) if (len > USB_MAX_STRING_LEN)
return -EINVAL; return -EINVAL;
ret = strscpy(string->string, page, size); return strscpy(string->string, page, size);
return len;
} }
CONFIGFS_ATTR(gadget_string_, s); CONFIGFS_ATTR(gadget_string_, s);