Commit 6f4388bc authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

[PATCH] USB: fix error paths in kobil_sct

some error codes are incorrect and there's an URB leak in an error path.
parent 33d61f24
......@@ -262,7 +262,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
// 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 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
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 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
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
......
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