Skip to content

Commit d4691c3

Browse files
jhovoldgregkh
authored andcommitted
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent db6e918 commit d4691c3

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

drivers/usb/serial/pl2303.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -503,21 +503,20 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port)
503503
if (tty)
504504
pl2303_set_termios(tty, port, &tmp_termios);
505505

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-
513506
dbg("%s - submitting interrupt urb", __func__);
514507
result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
515508
if (result) {
516509
dev_err(&port->dev, "%s - failed submitting interrupt urb,"
517510
" error %d\n", __func__, result);
518-
pl2303_close(port);
519511
return result;
520512
}
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+
521520
port->port.drain_delay = 256;
522521
return 0;
523522
}

0 commit comments

Comments
 (0)