From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx> 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@xxxxxxxxxxx> --- drivers/usb/core/driver.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index f203fdbfb6f68e6cf52feb077f042045cb9bf3a8..460d4dde5994e783bdcad08b2abb6bb85ab3258f 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); --- base-commit: d8d936c51388442f769a81e512b505dcf87c6a51 change-id: 20241129-fix_usb-5b37e1d2730d Best regards, -- Zijun Hu <quic_zijuhu@xxxxxxxxxxx>