Commit 61370ffb authored by Daniele Bellucci's avatar Daniele Bellucci Committed by Greg Kroah-Hartman

[PATCH] USB: PATCH 4/19 Audit usb_register/usb_serial_register under divers/usb/serial

parent bc516b5b
...@@ -558,7 +558,7 @@ static void empeg_set_termios (struct usb_serial_port *port, struct termios *old ...@@ -558,7 +558,7 @@ static void empeg_set_termios (struct usb_serial_port *port, struct termios *old
static int __init empeg_init (void) static int __init empeg_init (void)
{ {
struct urb *urb; struct urb *urb;
int i; int i, retval;
/* create our write urb pool and transfer buffers */ /* create our write urb pool and transfer buffers */
spin_lock_init (&write_urb_pool_lock); spin_lock_init (&write_urb_pool_lock);
...@@ -570,7 +570,6 @@ static int __init empeg_init (void) ...@@ -570,7 +570,6 @@ static int __init empeg_init (void)
continue; continue;
} }
urb->transfer_buffer = NULL;
urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL);
if (!urb->transfer_buffer) { if (!urb->transfer_buffer) {
err("%s - out of memory for urb buffers.", err("%s - out of memory for urb buffers.",
...@@ -579,12 +578,27 @@ static int __init empeg_init (void) ...@@ -579,12 +578,27 @@ static int __init empeg_init (void)
} }
} }
usb_serial_register (&empeg_device); retval = usb_serial_register(&empeg_device);
usb_register (&empeg_driver); if (retval)
goto failed_usb_serial_register;
retval = usb_register(&empeg_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_VERSION ":" DRIVER_DESC); info(DRIVER_VERSION ":" DRIVER_DESC);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&empeg_device);
failed_usb_serial_register:
for (i = 0; i < NUM_URBS; ++i) {
if (write_urb_pool[i]) {
if (write_urb_pool[i]->transfer_buffer)
kfree(write_urb_pool[i]->transfer_buffer);
usb_free_urb(write_urb_pool[i]);
}
}
return retval;
} }
...@@ -593,7 +607,7 @@ static void __exit empeg_exit (void) ...@@ -593,7 +607,7 @@ static void __exit empeg_exit (void)
int i; int i;
unsigned long flags; unsigned long flags;
usb_register (&empeg_driver); usb_deregister(&empeg_driver);
usb_serial_deregister (&empeg_device); usb_serial_deregister (&empeg_device);
spin_lock_irqsave (&write_urb_pool_lock, flags); spin_lock_irqsave (&write_urb_pool_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment