Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94c51dca authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

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: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cf41aa9e
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -120,7 +120,10 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype,
				0, 0, buffer, 1, 0);
	kfree(buffer);

	if (retval < 0)
		return retval;

	return 0;
}

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 */
	mutex_lock(&serial->disc_mutex);
	if (!serial->disconnected)
	if (!serial->disconnected) {
		ret = send_control_msg(port, CONTROL_RTS, !rts);
	else
		if (ret)
			ret = usb_translate_errors(ret);
	} else {
		ret = -ENODEV;
	}
	mutex_unlock(&serial->disc_mutex);

	return ret;