linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: misc: usb3503: Fix logic in usb3503_init()
@ 2021-02-09 11:30 Michal Simek
  2021-02-09 11:59 ` Greg Kroah-Hartman
  2021-02-09 12:01 ` Johan Hovold
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Simek @ 2021-02-09 11:30 UTC (permalink / raw)
  To: linux-kernel, monstr, michal.simek, git
  Cc: Greg Kroah-Hartman, Paul Cercueil, linux-usb

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>
---

 drivers/usb/misc/usb3503.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
index 48099c6bf04c..3aae83fbebae 100644
--- a/drivers/usb/misc/usb3503.c
+++ b/drivers/usb/misc/usb3503.c
@@ -409,13 +409,17 @@ 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);
+		return err;
+	}
 
 	return 0;
 }
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-09 12:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09 11:30 [PATCH] usb: misc: usb3503: Fix logic in usb3503_init() Michal Simek
2021-02-09 11:59 ` Greg Kroah-Hartman
2021-02-09 12:01 ` Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).