Make sure we return 0 or a negative error number appropriate for
userspace on errors.

Signed-off-by: Johan Hovold <jhov...@gmail.com>
---
 drivers/usb/serial/pl2303.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 4b709585..849d6d3 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -553,10 +553,13 @@ static int pl2303_tiocmset(struct tty_struct *tty,
        spin_unlock_irqrestore(&priv->lock, flags);
 
        mutex_lock(&serial->disc_mutex);
-       if (!serial->disconnected)
+       if (!serial->disconnected) {
                ret = pl2303_set_control_lines(port, control);
-       else
+               if (ret)
+                       ret = usb_translate_errors(ret);
+       } else {
                ret = -ENODEV;
+       }
        mutex_unlock(&serial->disc_mutex);
 
        return ret;
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to