[PATCH 6/6] USB: serial: kl5kusb105: fix port-settings error handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix port-settings error handling in order to detect a short transfer.

Note that this currently only implies that an error is logged.

Signed-off-by: Johan Hovold <johan@xxxxxxxxxx>
---
 drivers/usb/serial/kl5kusb105.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index 595415e59d5d..9b27f3d6029f 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -138,9 +138,11 @@ static int klsi_105_chg_port_settings(struct usb_serial_port *port,
 			settings,
 			sizeof(struct klsi_105_port_settings),
 			KLSI_TIMEOUT);
-	if (rc < 0)
-		dev_err(&port->dev,
-			"Change port settings failed (error = %d)\n", rc);
+	if (rc < sizeof(*settings)) {
+		dev_err(&port->dev, "failed to change port settings: %d\n", rc);
+		if (rc >= 0)
+			rc = -EIO;
+	}
 
 	dev_dbg(&port->dev,
 		"pktlen %u, baudrate 0x%02x, databits %u, u1 %u, u2 %u\n",
-- 
2.10.2

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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux