提交 bcbb9d81 编写于 作者: J Johan Hovold

USB: serial: cp210x: disable interface on errors in open

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.orgReviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NJohan Hovold <johan@kernel.org>
上级 eb0c68ea
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册