diff options
-rw-r--r-- | drivers/pci/pci-driver.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 99d867bcf22a..888191a3b0d1 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -48,7 +48,7 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count) | |||
48 | subdevice=PCI_ANY_ID, class=0, class_mask=0; | 48 | subdevice=PCI_ANY_ID, class=0, class_mask=0; |
49 | unsigned long driver_data=0; | 49 | unsigned long driver_data=0; |
50 | int fields=0; | 50 | int fields=0; |
51 | int retval; | 51 | int retval=0; |
52 | 52 | ||
53 | fields = sscanf(buf, "%x %x %x %x %x %x %lx", | 53 | fields = sscanf(buf, "%x %x %x %x %x %x %lx", |
54 | &vendor, &device, &subvendor, &subdevice, | 54 | &vendor, &device, &subvendor, &subdevice, |
@@ -58,16 +58,18 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count) | |||
58 | 58 | ||
59 | /* Only accept driver_data values that match an existing id_table | 59 | /* Only accept driver_data values that match an existing id_table |
60 | entry */ | 60 | entry */ |
61 | retval = -EINVAL; | 61 | if (ids) { |
62 | while (ids->vendor || ids->subvendor || ids->class_mask) { | 62 | retval = -EINVAL; |
63 | if (driver_data == ids->driver_data) { | 63 | while (ids->vendor || ids->subvendor || ids->class_mask) { |
64 | retval = 0; | 64 | if (driver_data == ids->driver_data) { |
65 | break; | 65 | retval = 0; |
66 | break; | ||
67 | } | ||
68 | ids++; | ||
66 | } | 69 | } |
67 | ids++; | 70 | if (retval) /* No match */ |
71 | return retval; | ||
68 | } | 72 | } |
69 | if (retval) /* No match */ | ||
70 | return retval; | ||
71 | 73 | ||
72 | dynid = kzalloc(sizeof(*dynid), GFP_KERNEL); | 74 | dynid = kzalloc(sizeof(*dynid), GFP_KERNEL); |
73 | if (!dynid) | 75 | if (!dynid) |