]> git.karo-electronics.de Git - linux-beck.git/blobdiff - drivers/usb/serial/ark3116.c
USB: serial: ark3116: fix register-accessor error handling
[linux-beck.git] / drivers / usb / serial / ark3116.c
index 1532cde8a437b596b7ed1442aaa127666cdadb9f..7812052dc7001519f4f73e5e2afa34857ae21431 100644 (file)
@@ -99,10 +99,17 @@ static int ark3116_read_reg(struct usb_serial *serial,
                                 usb_rcvctrlpipe(serial->dev, 0),
                                 0xfe, 0xc0, 0, reg,
                                 buf, 1, ARK_TIMEOUT);
-       if (result < 0)
+       if (result < 1) {
+               dev_err(&serial->interface->dev,
+                               "failed to read register %u: %d\n",
+                               reg, result);
+               if (result >= 0)
+                       result = -EIO;
+
                return result;
-       else
-               return buf[0];
+       }
+
+       return buf[0];
 }
 
 static inline int calc_divisor(int bps)