mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 16:41:25 +00:00
[PATCH] usbserial: Fixes wrong return values.
Some usbserial functions returns -EINVAL if the port doesn't exist or if it's not opened. However, the right error code for such situations is -ENODEV. Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
043ea18b2e
commit
db54a53d26
1 changed files with 6 additions and 8 deletions
|
@ -305,7 +305,7 @@ exit:
|
||||||
static int serial_write_room (struct tty_struct *tty)
|
static int serial_write_room (struct tty_struct *tty)
|
||||||
{
|
{
|
||||||
struct usb_serial_port *port = tty->driver_data;
|
struct usb_serial_port *port = tty->driver_data;
|
||||||
int retval = -EINVAL;
|
int retval = -ENODEV;
|
||||||
|
|
||||||
if (!port)
|
if (!port)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -327,7 +327,7 @@ exit:
|
||||||
static int serial_chars_in_buffer (struct tty_struct *tty)
|
static int serial_chars_in_buffer (struct tty_struct *tty)
|
||||||
{
|
{
|
||||||
struct usb_serial_port *port = tty->driver_data;
|
struct usb_serial_port *port = tty->driver_data;
|
||||||
int retval = -EINVAL;
|
int retval = -ENODEV;
|
||||||
|
|
||||||
if (!port)
|
if (!port)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -497,19 +497,18 @@ static int serial_tiocmget (struct tty_struct *tty, struct file *file)
|
||||||
struct usb_serial_port *port = tty->driver_data;
|
struct usb_serial_port *port = tty->driver_data;
|
||||||
|
|
||||||
if (!port)
|
if (!port)
|
||||||
goto exit;
|
return -ENODEV;
|
||||||
|
|
||||||
dbg("%s - port %d", __FUNCTION__, port->number);
|
dbg("%s - port %d", __FUNCTION__, port->number);
|
||||||
|
|
||||||
if (!port->open_count) {
|
if (!port->open_count) {
|
||||||
dbg("%s - port not open", __FUNCTION__);
|
dbg("%s - port not open", __FUNCTION__);
|
||||||
goto exit;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port->serial->type->tiocmget)
|
if (port->serial->type->tiocmget)
|
||||||
return port->serial->type->tiocmget(port, file);
|
return port->serial->type->tiocmget(port, file);
|
||||||
|
|
||||||
exit:
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,19 +518,18 @@ static int serial_tiocmset (struct tty_struct *tty, struct file *file,
|
||||||
struct usb_serial_port *port = tty->driver_data;
|
struct usb_serial_port *port = tty->driver_data;
|
||||||
|
|
||||||
if (!port)
|
if (!port)
|
||||||
goto exit;
|
return -ENODEV;
|
||||||
|
|
||||||
dbg("%s - port %d", __FUNCTION__, port->number);
|
dbg("%s - port %d", __FUNCTION__, port->number);
|
||||||
|
|
||||||
if (!port->open_count) {
|
if (!port->open_count) {
|
||||||
dbg("%s - port not open", __FUNCTION__);
|
dbg("%s - port not open", __FUNCTION__);
|
||||||
goto exit;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port->serial->type->tiocmset)
|
if (port->serial->type->tiocmset)
|
||||||
return port->serial->type->tiocmset(port, file, set, clear);
|
return port->serial->type->tiocmset(port, file, set, clear);
|
||||||
|
|
||||||
exit:
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue