projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
eb0c68e
)
USB: serial: cp210x: disable interface on errors in open
author
Johan Hovold
<johan@kernel.org>
Mon, 13 Jul 2020 10:55:13 +0000
(12:55 +0200)
committer
Johan Hovold
<johan@kernel.org>
Tue, 14 Jul 2020 09:47:30 +0000
(11:47 +0200)
Try to disable the serial interface in the unlikely event that generic
open() fails.
Link:
https://lore.kernel.org/r/20200713105517.27796-2-johan@kernel.org
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/cp210x.c
patch
|
blob
|
history
diff --git
a/drivers/usb/serial/cp210x.c
b/drivers/usb/serial/cp210x.c
index a90801ef005548a1189b193a989b4f60c25af237..c01c7863dd1a2b888702d2f054243ac06e10577a 100644
(file)
--- a/
drivers/usb/serial/cp210x.c
+++ b/
drivers/usb/serial/cp210x.c
@@
-824,7
+824,16
@@
static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port)
if (tty)
cp210x_change_speed(tty, port, NULL);
- return usb_serial_generic_open(tty, port);
+ result = usb_serial_generic_open(tty, port);
+ if (result)
+ goto err_disable;
+
+ return 0;
+
+err_disable:
+ cp210x_write_u16_reg(port, CP210X_IFC_ENABLE, UART_DISABLE);
+
+ return result;
}
static void cp210x_close(struct usb_serial_port *port)