diff options
author | Johan Hovold <johan@kernel.org> | 2017-01-06 13:15:13 -0500 |
---|---|---|
committer | Johan Hovold <johan@kernel.org> | 2017-01-09 08:55:38 -0500 |
commit | f2950b78547ffb8475297ada6b92bc2d774d5461 (patch) | |
tree | 59e72b647441540b647a4571d091e3407e62d37d /drivers/usb | |
parent | 030ee7ae52a46a2be52ccc8242c4a330aba8d38e (diff) |
USB: serial: ch341: fix open error handling
Make sure to stop the interrupt URB before returning on errors during
open.
Fixes: 664d5df92e88 ("USB: usb-serial ch341: support for DTR/RTS/CTS")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/ch341.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index 0cc5056b304d..8f41d4385f1c 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -319,7 +319,7 @@ static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
319 | 319 | ||
320 | r = ch341_configure(serial->dev, priv); | 320 | r = ch341_configure(serial->dev, priv); |
321 | if (r) | 321 | if (r) |
322 | goto out; | 322 | return r; |
323 | 323 | ||
324 | if (tty) | 324 | if (tty) |
325 | ch341_set_termios(tty, port, NULL); | 325 | ch341_set_termios(tty, port, NULL); |
@@ -329,12 +329,19 @@ static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
329 | if (r) { | 329 | if (r) { |
330 | dev_err(&port->dev, "%s - failed to submit interrupt urb: %d\n", | 330 | dev_err(&port->dev, "%s - failed to submit interrupt urb: %d\n", |
331 | __func__, r); | 331 | __func__, r); |
332 | goto out; | 332 | return r; |
333 | } | 333 | } |
334 | 334 | ||
335 | r = usb_serial_generic_open(tty, port); | 335 | r = usb_serial_generic_open(tty, port); |
336 | if (r) | ||
337 | goto err_kill_interrupt_urb; | ||
338 | |||
339 | return 0; | ||
340 | |||
341 | err_kill_interrupt_urb: | ||
342 | usb_kill_urb(port->interrupt_in_urb); | ||
336 | 343 | ||
337 | out: return r; | 344 | return r; |
338 | } | 345 | } |
339 | 346 | ||
340 | /* Old_termios contains the original termios settings and | 347 | /* Old_termios contains the original termios settings and |