Commit 5f92aee9 authored by Johan Hovold's avatar Johan Hovold

USB: serial: fix return value for unsupported ioctls

Drivers should return -ENOTTY ("Inappropriate I/O control operation")
when an ioctl isn't supported, while -EINVAL is used for invalid
arguments.

Fix up the TIOCMGET, TIOCMSET and TIOCGICOUNT helpers which returned
-EINVAL when a USB serial driver did not implement the corresponding
methods.

Note that the TIOCMGET and TIOCMSET helpers predate git and do not get a
corresponding Fixes tag below.

Fixes: d281da7f ("tty: Make tiocgicount a handler")
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
parent 6f9f8aea
......@@ -540,7 +540,7 @@ static int serial_tiocmget(struct tty_struct *tty)
if (port->serial->type->tiocmget)
return port->serial->type->tiocmget(tty);
return -EINVAL;
return -ENOTTY;
}
static int serial_tiocmset(struct tty_struct *tty,
......@@ -552,7 +552,7 @@ static int serial_tiocmset(struct tty_struct *tty,
if (port->serial->type->tiocmset)
return port->serial->type->tiocmset(tty, set, clear);
return -EINVAL;
return -ENOTTY;
}
static int serial_get_icount(struct tty_struct *tty,
......@@ -564,7 +564,7 @@ static int serial_get_icount(struct tty_struct *tty,
if (port->serial->type->get_icount)
return port->serial->type->get_icount(tty, icount);
return -EINVAL;
return -ENOTTY;
}
/*
......
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