PCI: allow pci driver to support only dynids

commit b41d6cf38e (PCI: Check dynids driver_data value for validity)
requires all drivers to include an id table to try and match
driver_data.  Before validating driver_data check driver has an id
table.

Acked-by: Jean Delvare <khali@linux-fr.org>
Cc: Milton Miller <miltonm@bga.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
Chris Wright 2008-11-25 19:36:10 -08:00 committed by Jesse Barnes
parent 56ee325e25
commit 2debb4d201

View File

@ -48,7 +48,7 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count)
subdevice=PCI_ANY_ID, class=0, class_mask=0; subdevice=PCI_ANY_ID, class=0, class_mask=0;
unsigned long driver_data=0; unsigned long driver_data=0;
int fields=0; int fields=0;
int retval; int retval=0;
fields = sscanf(buf, "%x %x %x %x %x %x %lx", fields = sscanf(buf, "%x %x %x %x %x %x %lx",
&vendor, &device, &subvendor, &subdevice, &vendor, &device, &subvendor, &subdevice,
@ -58,16 +58,18 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count)
/* Only accept driver_data values that match an existing id_table /* Only accept driver_data values that match an existing id_table
entry */ entry */
retval = -EINVAL; if (ids) {
while (ids->vendor || ids->subvendor || ids->class_mask) { retval = -EINVAL;
if (driver_data == ids->driver_data) { while (ids->vendor || ids->subvendor || ids->class_mask) {
retval = 0; if (driver_data == ids->driver_data) {
break; retval = 0;
break;
}
ids++;
} }
ids++; if (retval) /* No match */
return retval;
} }
if (retval) /* No match */
return retval;
dynid = kzalloc(sizeof(*dynid), GFP_KERNEL); dynid = kzalloc(sizeof(*dynid), GFP_KERNEL);
if (!dynid) if (!dynid)