diff options
author | Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> | 2006-06-12 21:46:20 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-21 18:04:18 -0400 |
commit | db54a53d26322e978e66482208afabaab9cd0752 (patch) | |
tree | 389920f93a45647fec5f90eb27e75213c27934f9 | |
parent | 043ea18b2e145c4c9cb3c30757a65fe0f1678a35 (diff) |
[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>
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 92c213fa931..a30135c7cfe 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -305,7 +305,7 @@ exit: | |||
305 | static int serial_write_room (struct tty_struct *tty) | 305 | static int serial_write_room (struct tty_struct *tty) |
306 | { | 306 | { |
307 | struct usb_serial_port *port = tty->driver_data; | 307 | struct usb_serial_port *port = tty->driver_data; |
308 | int retval = -EINVAL; | 308 | int retval = -ENODEV; |
309 | 309 | ||
310 | if (!port) | 310 | if (!port) |
311 | goto exit; | 311 | goto exit; |
@@ -327,7 +327,7 @@ exit: | |||
327 | static int serial_chars_in_buffer (struct tty_struct *tty) | 327 | static int serial_chars_in_buffer (struct tty_struct *tty) |
328 | { | 328 | { |
329 | struct usb_serial_port *port = tty->driver_data; | 329 | struct usb_serial_port *port = tty->driver_data; |
330 | int retval = -EINVAL; | 330 | int retval = -ENODEV; |
331 | 331 | ||
332 | if (!port) | 332 | if (!port) |
333 | goto exit; | 333 | goto exit; |
@@ -497,19 +497,18 @@ static int serial_tiocmget (struct tty_struct *tty, struct file *file) | |||
497 | struct usb_serial_port *port = tty->driver_data; | 497 | struct usb_serial_port *port = tty->driver_data; |
498 | 498 | ||
499 | if (!port) | 499 | if (!port) |
500 | goto exit; | 500 | return -ENODEV; |
501 | 501 | ||
502 | dbg("%s - port %d", __FUNCTION__, port->number); | 502 | dbg("%s - port %d", __FUNCTION__, port->number); |
503 | 503 | ||
504 | if (!port->open_count) { | 504 | if (!port->open_count) { |
505 | dbg("%s - port not open", __FUNCTION__); | 505 | dbg("%s - port not open", __FUNCTION__); |
506 | goto exit; | 506 | return -ENODEV; |
507 | } | 507 | } |
508 | 508 | ||
509 | if (port->serial->type->tiocmget) | 509 | if (port->serial->type->tiocmget) |
510 | return port->serial->type->tiocmget(port, file); | 510 | return port->serial->type->tiocmget(port, file); |
511 | 511 | ||
512 | exit: | ||
513 | return -EINVAL; | 512 | return -EINVAL; |
514 | } | 513 | } |
515 | 514 | ||
@@ -519,19 +518,18 @@ static int serial_tiocmset (struct tty_struct *tty, struct file *file, | |||
519 | struct usb_serial_port *port = tty->driver_data; | 518 | struct usb_serial_port *port = tty->driver_data; |
520 | 519 | ||
521 | if (!port) | 520 | if (!port) |
522 | goto exit; | 521 | return -ENODEV; |
523 | 522 | ||
524 | dbg("%s - port %d", __FUNCTION__, port->number); | 523 | dbg("%s - port %d", __FUNCTION__, port->number); |
525 | 524 | ||
526 | if (!port->open_count) { | 525 | if (!port->open_count) { |
527 | dbg("%s - port not open", __FUNCTION__); | 526 | dbg("%s - port not open", __FUNCTION__); |
528 | goto exit; | 527 | return -ENODEV; |
529 | } | 528 | } |
530 | 529 | ||
531 | if (port->serial->type->tiocmset) | 530 | if (port->serial->type->tiocmset) |
532 | return port->serial->type->tiocmset(port, file, set, clear); | 531 | return port->serial->type->tiocmset(port, file, set, clear); |
533 | 532 | ||
534 | exit: | ||
535 | return -EINVAL; | 533 | return -EINVAL; |
536 | } | 534 | } |
537 | 535 | ||