diff options
author | Johan Hovold <johan@kernel.org> | 2021-04-07 12:39:20 +0200 |
---|---|---|
committer | Johan Hovold <johan@kernel.org> | 2021-04-08 09:46:01 +0200 |
commit | 5f92aee93a68c3f3b13dc28a7e220adbdc3433b0 (patch) | |
tree | b4ca87e4f861327bbde22d13aeaa848b8952b6a6 | |
parent | 6f9f8aeab7fd5cc9a54096f5053fa3c79154756e (diff) | |
download | linux-5f92aee93a68c3f3b13dc28a7e220adbdc3433b0.tar.gz linux-5f92aee93a68c3f3b13dc28a7e220adbdc3433b0.tar.bz2 linux-5f92aee93a68c3f3b13dc28a7e220adbdc3433b0.zip |
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: d281da7ff6f7 ("tty: Make tiocgicount a handler")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index aaae71a0bbff..f53a830f4094 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -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; } /* |