usg: gadget: Move validation out of lock in webusb_bcdVersion_store()

Validation has nothing to do with any protected data,
move it out of the lock and make code neater.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230127112638.84806-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Andy Shevchenko 2023-01-27 13:26:38 +02:00 committed by Greg Kroah-Hartman
parent 2bf40502ba
commit 582cef4385
1 changed files with 3 additions and 7 deletions

View File

@ -836,19 +836,15 @@ static ssize_t webusb_bcdVersion_store(struct config_item *item,
if (ret)
return ret;
mutex_lock(&gi->lock);
ret = is_valid_bcd(bcdVersion);
if (ret)
goto out;
return ret;
mutex_lock(&gi->lock);
gi->bcd_webusb_version = bcdVersion;
ret = len;
out:
mutex_unlock(&gi->lock);
return ret;
return len;
}
static ssize_t webusb_bVendorCode_show(struct config_item *item, char *page)