diff options
author | Johan Hovold <jhovold@gmail.com> | 2011-11-06 13:06:35 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-11-15 13:43:30 -0500 |
commit | d4691c3fa3d371835b1eacb39066ab113c4b9d8c (patch) | |
tree | 19a1ed1b781a337d703444363787615e23930c06 /drivers | |
parent | db6e9186c90188edea20aaa5161ea073440cc2a1 (diff) |
USB: pl2302: clean up error handling in open
Reorder urb submission and simply kill interrupt urb should read-urb
submission fail (rather than calling close).
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/serial/pl2303.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 506d1e930c3e..9fdc944ff48d 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -503,21 +503,20 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
503 | if (tty) | 503 | if (tty) |
504 | pl2303_set_termios(tty, port, &tmp_termios); | 504 | pl2303_set_termios(tty, port, &tmp_termios); |
505 | 505 | ||
506 | dbg("%s - submitting read urb", __func__); | ||
507 | result = usb_serial_generic_submit_read_urb(port, GFP_KERNEL); | ||
508 | if (result) { | ||
509 | pl2303_close(port); | ||
510 | return result; | ||
511 | } | ||
512 | |||
513 | dbg("%s - submitting interrupt urb", __func__); | 506 | dbg("%s - submitting interrupt urb", __func__); |
514 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 507 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
515 | if (result) { | 508 | if (result) { |
516 | dev_err(&port->dev, "%s - failed submitting interrupt urb," | 509 | dev_err(&port->dev, "%s - failed submitting interrupt urb," |
517 | " error %d\n", __func__, result); | 510 | " error %d\n", __func__, result); |
518 | pl2303_close(port); | ||
519 | return result; | 511 | return result; |
520 | } | 512 | } |
513 | |||
514 | result = usb_serial_generic_submit_read_urb(port, GFP_KERNEL); | ||
515 | if (result) { | ||
516 | usb_kill_urb(port->interrupt_in_urb); | ||
517 | return result; | ||
518 | } | ||
519 | |||
521 | port->port.drain_delay = 256; | 520 | port->port.drain_delay = 256; |
522 | return 0; | 521 | return 0; |
523 | } | 522 | } |