USB: pl2303: fix return value of tiocmset
authorJohan Hovold <jhovold@gmail.com>
Thu, 21 Mar 2013 11:37:44 +0000 (12:37 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Mar 2013 20:54:31 +0000 (13:54 -0700)
Make sure we return 0 or a negative error number appropriate for
userspace on errors.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/pl2303.c

index 997eba4dcbeb656b43644d3c3f091945c75fe294..4dff17902fa04990f3bdb7d00c904cea5974cdd6 100644 (file)
@@ -550,10 +550,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;