summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2021-02-09 13:32:19 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-02-11 13:52:04 +0100
commit7a1e838d0cdce7d09a0bd81d45c7b5a660e71ac7 (patch)
tree3a83045fbb23b1dccec2b0f532048411b4aebea5 /drivers/usb
parentcdf71946a9b12b04ffcd89662dd7b91a52ab5186 (diff)
usb: misc: usb3503: Fix logic in usb3503_init()
Based on https://lore.kernel.org/linux-arm-kernel/YCJv59g3Tq2haDSa@kroah.com/ initialization should fail if any registration fails. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Link: https://lore.kernel.org/r/a8547f6fe698014df08cad3bcc9c5d9a7137d8b8.1612873935.git.michal.simek@xilinx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/misc/usb3503.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
index 48099c6bf04c..330f494cd158 100644
--- a/drivers/usb/misc/usb3503.c
+++ b/drivers/usb/misc/usb3503.c
@@ -409,13 +409,18 @@ static int __init usb3503_init(void)
int err;
err = i2c_add_driver(&usb3503_i2c_driver);
- if (err != 0)
+ if (err) {
pr_err("usb3503: Failed to register I2C driver: %d\n", err);
+ return err;
+ }
err = platform_driver_register(&usb3503_platform_driver);
- if (err != 0)
+ if (err) {
pr_err("usb3503: Failed to register platform driver: %d\n",
err);
+ i2c_del_driver(&usb3503_i2c_driver);
+ return err;
+ }
return 0;
}