Commit 3ff4fd94 authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

USB: race fixes for usb-serial, step 3

- fix an error code returned if a device has been disconnected
Signed-off-by: default avatarOliver Neukum <oneukum@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 4b10f0f3
...@@ -281,7 +281,7 @@ static void serial_close(struct tty_struct *tty, struct file * filp) ...@@ -281,7 +281,7 @@ static void serial_close(struct tty_struct *tty, struct file * filp)
static int serial_write (struct tty_struct * tty, const unsigned char *buf, int count) static int serial_write (struct tty_struct * tty, const unsigned char *buf, int count)
{ {
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
int retval = -EINVAL; int retval = -ENODEV;
if (!port || port->serial->dev->state == USB_STATE_NOTATTACHED) if (!port || port->serial->dev->state == USB_STATE_NOTATTACHED)
goto exit; goto exit;
...@@ -289,6 +289,7 @@ static int serial_write (struct tty_struct * tty, const unsigned char *buf, int ...@@ -289,6 +289,7 @@ static int serial_write (struct tty_struct * tty, const unsigned char *buf, int
dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count); dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count);
if (!port->open_count) { if (!port->open_count) {
retval = -EINVAL;
dbg("%s - port not opened", __FUNCTION__); dbg("%s - port not opened", __FUNCTION__);
goto exit; goto exit;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment