Commit 2debb4d2 authored by Chris Wright's avatar Chris Wright Committed by Jesse Barnes

PCI: allow pci driver to support only dynids

commit b41d6cf3 (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: default avatarJean Delvare <khali@linux-fr.org>
Cc: Milton Miller <miltonm@bga.com>
Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 56ee325e
...@@ -48,7 +48,7 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count) ...@@ -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,6 +58,7 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count) ...@@ -58,6 +58,7 @@ 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 */
if (ids) {
retval = -EINVAL; retval = -EINVAL;
while (ids->vendor || ids->subvendor || ids->class_mask) { while (ids->vendor || ids->subvendor || ids->class_mask) {
if (driver_data == ids->driver_data) { if (driver_data == ids->driver_data) {
...@@ -68,6 +69,7 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count) ...@@ -68,6 +69,7 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count)
} }
if (retval) /* No match */ if (retval) /* No match */
return retval; return retval;
}
dynid = kzalloc(sizeof(*dynid), GFP_KERNEL); dynid = kzalloc(sizeof(*dynid), GFP_KERNEL);
if (!dynid) if (!dynid)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment