aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/serial/omninet.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/omninet.c')
-rw-r--r--drivers/usb/serial/omninet.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index 0216ac12a27..357cc11915c 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -170,8 +170,12 @@ static int omninet_open (struct usb_serial_port *port, struct file *filp)
port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
omninet_read_bulk_callback, port);
result = usb_submit_urb(port->read_urb, GFP_KERNEL);
- if (result)
+ if (result) {
err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
+ /* open failed - all allocations must be freed */
+ kfree(od);
+ usb_set_serial_port_data(port, NULL);
+ }
return result;
}