ChangeSet 1.1673.8.22, 2004/03/25 17:19:03-08:00, oliver@neukum.org [PATCH] USB: fix error paths in kobil_sct some error codes are incorrect and there's an URB leak in an error path. drivers/usb/serial/kobil_sct.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff -Nru a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c --- a/drivers/usb/serial/kobil_sct.c Wed Apr 14 14:38:31 2004 +++ b/drivers/usb/serial/kobil_sct.c Wed Apr 14 14:38:31 2004 @@ -262,7 +262,7 @@ // allocate memory for transfer buffer transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL); if (! transfer_buffer) { - return -1; + return -ENOMEM; } else { memset(transfer_buffer, 0, transfer_buffer_length); } @@ -274,7 +274,7 @@ if (!port->write_urb) { dbg("%s - port %d usb_alloc_urb failed", __FUNCTION__, port->number); kfree(transfer_buffer); - return -1; + return -ENOMEM; } } @@ -282,7 +282,9 @@ port->write_urb->transfer_buffer = (unsigned char *) kmalloc(write_urb_transfer_buffer_length, GFP_KERNEL); if (! port->write_urb->transfer_buffer) { kfree(transfer_buffer); - return -1; + usb_free_urb(port->write_urb); + port->write_urb = NULL; + return -ENOMEM; } // get hardware version