public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] - missing check in usb/serial/usb-serial.c.
@ 2004-09-13 21:43 Luiz Fernando N. Capitulino
  2004-09-14 19:04 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Fernando N. Capitulino @ 2004-09-13 21:43 UTC (permalink / raw)
  To: greg; +Cc: linux-kernel


 Hi Greg,

 This patch add a missing check in the call to bus_register() and
not initialise `result' (which is not necessary).


Signed-off-by: Luiz Capitulino <lcapitulino@conectiva.com.br>

 drivers/usb/serial/usb-serial.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)


diff -X /home/capitulino/kernels/2.6/dontdiff -Nparu a/drivers/usb/serial/usb-serial.c a~/drivers/usb/serial/usb-serial.c
--- a/drivers/usb/serial/usb-serial.c	2004-08-26 12:31:41.000000000 -0300
+++ a~/drivers/usb/serial/usb-serial.c	2004-09-12 18:12:30.000000000 -0300
@@ -1229,7 +1229,7 @@ struct tty_driver *usb_serial_tty_driver
 static int __init usb_serial_init(void)
 {
 	int i;
-	int result = 0;
+	int result;
 
 	usb_serial_tty_driver = alloc_tty_driver(SERIAL_TTY_MINORS);
 	if (!usb_serial_tty_driver)
@@ -1240,13 +1240,17 @@ static int __init usb_serial_init(void)
 		serial_table[i] = NULL;
 	}
 
-	bus_register(&usb_serial_bus_type);
+	result = bus_register(&usb_serial_bus_type);
+	if (result) {
+		err("%s - registering bus driver failed", __FUNCTION__);
+		goto exit_bus;
+	}
 
 	/* register the generic driver, if we should */
 	result = usb_serial_generic_register(debug);
 	if (result < 0) {
 		err("%s - registering generic driver failed", __FUNCTION__);
-		goto exit;
+		goto exit_generic;
 	}
 
 	usb_serial_tty_driver->owner = THIS_MODULE;
@@ -1264,7 +1268,7 @@ static int __init usb_serial_init(void)
 	result = tty_register_driver(usb_serial_tty_driver);
 	if (result) {
 		err("%s - tty_register_driver failed", __FUNCTION__);
-		goto exit_generic;
+		goto exit_reg_driver;
 	}
 
 	/* register the USB driver */
@@ -1281,10 +1285,13 @@ static int __init usb_serial_init(void)
 exit_tty:
 	tty_unregister_driver(usb_serial_tty_driver);
 
-exit_generic:
+exit_reg_driver:
 	usb_serial_generic_deregister();
 
-exit:
+exit_generic:
+	bus_unregister(&usb_serial_bus_type);
+
+exit_bus:
 	err ("%s - returning with error %d", __FUNCTION__, result);
 	put_tty_driver(usb_serial_tty_driver);
 	return result;

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

* Re: [PATCH 1/2] - missing check in usb/serial/usb-serial.c.
  2004-09-13 21:43 [PATCH 1/2] - missing check in usb/serial/usb-serial.c Luiz Fernando N. Capitulino
@ 2004-09-14 19:04 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2004-09-14 19:04 UTC (permalink / raw)
  To: Luiz Fernando N. Capitulino; +Cc: linux-kernel

On Mon, Sep 13, 2004 at 06:43:39PM -0300, Luiz Fernando N. Capitulino wrote:
> 
>  Hi Greg,
> 
>  This patch add a missing check in the call to bus_register() and
> not initialise `result' (which is not necessary).

Applied, thanks.

greg k-h

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

end of thread, other threads:[~2004-09-14 19:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-13 21:43 [PATCH 1/2] - missing check in usb/serial/usb-serial.c Luiz Fernando N. Capitulino
2004-09-14 19:04 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox