Commit d7c90d9f authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman
Browse files

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: fc274c1e ("USB: gadget: Add a new bus for gadgets")
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20220504135840.232209-1-colin.i.king@gmail.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3120aac6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1559,9 +1559,9 @@ 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;
		}
	}
	mutex_unlock(&udc_lock);

	if (ret)