forked from Minki/linux
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: cf5276ce78
("USB: serial: cp210x: Adding GPIO support for CP2105")
Signed-off-by: Sebastian Frei <dr.nop@gmx.net>
[ johan: amend commit message; shorten error message and demote to
warning; drop unnecessary move of usb_set_serial_data() ]
Cc: stable <stable@vger.kernel.org> # 4.9
Signed-off-by: Johan Hovold <johan@kernel.org>
This commit is contained in:
parent
837ddc4793
commit
7eac35ea29
@ -352,6 +352,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
|
|||||||
#define CP210X_PARTNUM_CP2104 0x04
|
#define CP210X_PARTNUM_CP2104 0x04
|
||||||
#define CP210X_PARTNUM_CP2105 0x05
|
#define CP210X_PARTNUM_CP2105 0x05
|
||||||
#define CP210X_PARTNUM_CP2108 0x08
|
#define CP210X_PARTNUM_CP2108 0x08
|
||||||
|
#define CP210X_PARTNUM_UNKNOWN 0xFF
|
||||||
|
|
||||||
/* CP210X_GET_COMM_STATUS returns these 0x13 bytes */
|
/* CP210X_GET_COMM_STATUS returns these 0x13 bytes */
|
||||||
struct cp210x_comm_status {
|
struct cp210x_comm_status {
|
||||||
@ -1491,8 +1492,11 @@ static int cp210x_attach(struct usb_serial *serial)
|
|||||||
result = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST,
|
result = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST,
|
||||||
CP210X_GET_PARTNUM, &priv->partnum,
|
CP210X_GET_PARTNUM, &priv->partnum,
|
||||||
sizeof(priv->partnum));
|
sizeof(priv->partnum));
|
||||||
if (result < 0)
|
if (result < 0) {
|
||||||
goto err_free_priv;
|
dev_warn(&serial->interface->dev,
|
||||||
|
"querying part number failed\n");
|
||||||
|
priv->partnum = CP210X_PARTNUM_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
usb_set_serial_data(serial, priv);
|
usb_set_serial_data(serial, priv);
|
||||||
|
|
||||||
@ -1505,10 +1509,6 @@ static int cp210x_attach(struct usb_serial *serial)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err_free_priv:
|
|
||||||
kfree(priv);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cp210x_disconnect(struct usb_serial *serial)
|
static void cp210x_disconnect(struct usb_serial *serial)
|
||||||
|
Loading…
Reference in New Issue
Block a user