ftdi-la: do enter the error path upon VID:PID mismatch
Bug #1390 reports that "!desc" is always true (should be: false?). But the actual problem would be that 'desc' is _not_ NULL when none of the supported chips' VID:PID matched (FT232H happens to "get found" then, erroneously). Add a sentinel to the table of supported chips, such that 'desc' becomes NULL upon mismatch, and the error path is entered.
This commit is contained in:
parent
03f169b36b
commit
01ae826ba3
|
@ -81,6 +81,7 @@ static const struct ftdi_chip_desc *chip_descs[] = {
|
||||||
&ft2232h_desc,
|
&ft2232h_desc,
|
||||||
&ft232r_desc,
|
&ft232r_desc,
|
||||||
&ft232h_desc,
|
&ft232h_desc,
|
||||||
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void scan_device(struct ftdi_context *ftdic,
|
static void scan_device(struct ftdi_context *ftdic,
|
||||||
|
@ -98,6 +99,8 @@ static void scan_device(struct ftdi_context *ftdic,
|
||||||
desc = NULL;
|
desc = NULL;
|
||||||
for (unsigned long i = 0; i < ARRAY_SIZE(chip_descs); i++) {
|
for (unsigned long i = 0; i < ARRAY_SIZE(chip_descs); i++) {
|
||||||
desc = chip_descs[i];
|
desc = chip_descs[i];
|
||||||
|
if (!desc)
|
||||||
|
break;
|
||||||
if (desc->vendor == usb_desc.idVendor &&
|
if (desc->vendor == usb_desc.idVendor &&
|
||||||
desc->product == usb_desc.idProduct)
|
desc->product == usb_desc.idProduct)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue