diff options
| author | Zijun Hu <quic_zijuhu@quicinc.com> | 2024-12-12 23:30:05 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-12-23 18:40:34 +0100 |
| commit | e9509b499349965ee866aae8eea85e909d798c11 (patch) | |
| tree | 44038f5509b5ab4e08e0fccf465be18fcc8a03d4 /drivers/usb/core/driver.c | |
| parent | usb: dwc3: dwc3-am62: Re-initialize controller if lost power in PM suspend (diff) | |
| download | linux-e9509b499349965ee866aae8eea85e909d798c11.tar.gz linux-e9509b499349965ee866aae8eea85e909d798c11.zip | |
USB: Optimize goto logic in API usb_register_driver()
usb_register_driver() uses complex goto statements to handle simple error
cases, move down the goto label 'out' a bit to
- Simplify goto logic
- Leverage pr_err() prompt for driver registering failure.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20241212-fix_usb-v1-1-300eb440c753@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/driver.c')
| -rw-r--r-- | drivers/usb/core/driver.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index f203fdbfb6f6..460d4dde5994 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -1086,15 +1086,14 @@ int usb_register_driver(struct usb_driver *new_driver, struct module *owner, pr_info("%s: registered new interface driver %s\n", usbcore_name, new_driver->name); -out: - return retval; + return 0; out_newid: driver_unregister(&new_driver->driver); - +out: pr_err("%s: error %d registering interface driver %s\n", usbcore_name, retval, new_driver->name); - goto out; + return retval; } EXPORT_SYMBOL_GPL(usb_register_driver); |
