mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
USB: opticon: fix return value of tiocmset
Make sure we return 0 or a negative error number appropriate for userspace on errors. Currently 1 rather than 0 is returned on successful operation. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
cf41aa9e19
commit
94c51dca2c
@ -120,7 +120,10 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype,
|
|||||||
0, 0, buffer, 1, 0);
|
0, 0, buffer, 1, 0);
|
||||||
kfree(buffer);
|
kfree(buffer);
|
||||||
|
|
||||||
return retval;
|
if (retval < 0)
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int opticon_open(struct tty_struct *tty, struct usb_serial_port *port)
|
static int opticon_open(struct tty_struct *tty, struct usb_serial_port *port)
|
||||||
@ -329,10 +332,13 @@ static int opticon_tiocmset(struct tty_struct *tty,
|
|||||||
|
|
||||||
/* Send the new RTS state to the connected device */
|
/* Send the new RTS state to the connected device */
|
||||||
mutex_lock(&serial->disc_mutex);
|
mutex_lock(&serial->disc_mutex);
|
||||||
if (!serial->disconnected)
|
if (!serial->disconnected) {
|
||||||
ret = send_control_msg(port, CONTROL_RTS, !rts);
|
ret = send_control_msg(port, CONTROL_RTS, !rts);
|
||||||
else
|
if (ret)
|
||||||
|
ret = usb_translate_errors(ret);
|
||||||
|
} else {
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
|
}
|
||||||
mutex_unlock(&serial->disc_mutex);
|
mutex_unlock(&serial->disc_mutex);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user