diff options
author | Colin Ian King <colin.i.king@gmail.com> | 2022-05-04 15:58:40 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-05-05 21:52:35 +0200 |
commit | d7c90d9f9a5b6a85c09d37c5616d880d849a0c8b (patch) | |
tree | 04c051169b7f4a6fd2625e9b1015a653ae29a88f /drivers/usb/gadget | |
parent | usb: dwc2: gadget: don't reset gadget's driver->bus (diff) | |
download | linux-d7c90d9f9a5b6a85c09d37c5616d880d849a0c8b.tar.xz linux-d7c90d9f9a5b6a85c09d37c5616d880d849a0c8b.zip |
USB: gadget: Fix return of -EBUSY
Currently when driver->match_existing_only is true, the error return is
set to -EBUSY however ret is then set to 0 at the end of the if/else
statement. I believe the ret = 0 statement should be set in the else
part of the if statement and not at the end to ensure -EBUSY is being
returned correctly.
Detected by clang scan:
drivers/usb/gadget/udc/core.c:1558:4: warning: Value stored to 'ret' is
never read [deadcode.DeadStores]
Fixes: fc274c1e9973 ("USB: gadget: Add a new bus for gadgets")
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20220504135840.232209-1-colin.i.king@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/udc/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index 61790592b2c8..3281d8a3dae7 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -1559,8 +1559,8 @@ int usb_gadget_register_driver_owner(struct usb_gadget_driver *driver, } else { pr_info("%s: couldn't find an available UDC\n", driver->function); + ret = 0; } - ret = 0; } mutex_unlock(&udc_lock); |