]> git.karo-electronics.de Git - linux-beck.git/blobdiff - drivers/usb/serial/spcp8x5.c
USB: serial: spcp8x5: fix modem-status handling
[linux-beck.git] / drivers / usb / serial / spcp8x5.c
index 475e6c31b266b013ed4749b482c0477eda4a3904..ddfd787c461cb5367c1f932b3edffb42c0812832 100644 (file)
@@ -232,11 +232,17 @@ static int spcp8x5_get_msr(struct usb_serial_port *port, u8 *status)
        ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
                              GET_UART_STATUS, GET_UART_STATUS_TYPE,
                              0, GET_UART_STATUS_MSR, buf, 1, 100);
-       if (ret < 0)
+       if (ret < 1) {
                dev_err(&port->dev, "failed to get modem status: %d\n", ret);
+               if (ret >= 0)
+                       ret = -EIO;
+               goto out;
+       }
 
        dev_dbg(&port->dev, "0xc0:0x22:0:6  %d - 0x02%x\n", ret, *buf);
        *status = *buf;
+       ret = 0;
+out:
        kfree(buf);
 
        return ret;