aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/usb-serial.c
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2011-11-10 11:40:44 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-11-15 13:49:42 -0500
commitc6249ff7521c0211e9daa37f07a4c016a5c4d454 (patch)
treeec21f5ec94e2fc221bf883436899eee66486d82f /drivers/usb/serial/usb-serial.c
parent3e1f49011973ff3e67014d03cac50593004cee3c (diff)
USB: serial: do not forward USB specific errors in write
Use usb_translate_errors() to map USB-specific errors to errors appropriate for user space (ENOMEM, ENODEV and EIO) in write. Currently almost all serial drivers simply forward error codes from the stack (e.g. from usb_submit_urb()), but these codes often have different meanings in user-space. Doing the mapping in usb-serial core simplifies driver code and allows for more consistent error reporting. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r--drivers/usb/serial/usb-serial.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 5c4fcf8d5f98..8c46813b9afa 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -364,6 +364,8 @@ static int serial_write(struct tty_struct *tty, const unsigned char *buf,
364 364
365 /* pass on to the driver specific version of this function */ 365 /* pass on to the driver specific version of this function */
366 retval = port->serial->type->write(tty, port, buf, count); 366 retval = port->serial->type->write(tty, port, buf, count);
367 if (retval < 0)
368 retval = usb_translate_errors(retval);
367exit: 369exit:
368 return retval; 370 return retval;
369} 371}