Skip to content

Commit 7eac35e

Browse files
Sebastian Freijhovold
authored andcommitted
USB: serial: cp210x: fix partnum regression
When adding GPIO support for the cp2105, the mentioned commit by Martyn Welch introduced a query for the part number of the chip. Unfortunately the driver aborts probing when this query fails, so currently the driver can not be used with chips not supporting this query. I have a data cable for Siemens mobile phones (ID 10ab:10c5) where this is the case. With this patch the driver can be bound even if the part number can not be queried. Fixes: cf5276c ("USB: serial: cp210x: Adding GPIO support for CP2105") Signed-off-by: Sebastian Frei <[email protected]> [ johan: amend commit message; shorten error message and demote to warning; drop unnecessary move of usb_set_serial_data() ] Cc: stable <[email protected]> # 4.9 Signed-off-by: Johan Hovold <[email protected]>
1 parent 837ddc4 commit 7eac35e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/usb/serial/cp210x.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
352352
#define CP210X_PARTNUM_CP2104 0x04
353353
#define CP210X_PARTNUM_CP2105 0x05
354354
#define CP210X_PARTNUM_CP2108 0x08
355+
#define CP210X_PARTNUM_UNKNOWN 0xFF
355356

356357
/* CP210X_GET_COMM_STATUS returns these 0x13 bytes */
357358
struct cp210x_comm_status {
@@ -1491,8 +1492,11 @@ static int cp210x_attach(struct usb_serial *serial)
14911492
result = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST,
14921493
CP210X_GET_PARTNUM, &priv->partnum,
14931494
sizeof(priv->partnum));
1494-
if (result < 0)
1495-
goto err_free_priv;
1495+
if (result < 0) {
1496+
dev_warn(&serial->interface->dev,
1497+
"querying part number failed\n");
1498+
priv->partnum = CP210X_PARTNUM_UNKNOWN;
1499+
}
14961500

14971501
usb_set_serial_data(serial, priv);
14981502

@@ -1505,10 +1509,6 @@ static int cp210x_attach(struct usb_serial *serial)
15051509
}
15061510

15071511
return 0;
1508-
err_free_priv:
1509-
kfree(priv);
1510-
1511-
return result;
15121512
}
15131513

15141514
static void cp210x_disconnect(struct usb_serial *serial)

0 commit comments

Comments
 (0)