diff options
| -rw-r--r-- | drivers/edac/i7core_edac.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c index d7c76800988e..cc9357da0e34 100644 --- a/drivers/edac/i7core_edac.c +++ b/drivers/edac/i7core_edac.c | |||
| @@ -1947,21 +1947,26 @@ fail: | |||
| 1947 | * 0 for FOUND a device | 1947 | * 0 for FOUND a device |
| 1948 | * < 0 for error code | 1948 | * < 0 for error code |
| 1949 | */ | 1949 | */ |
| 1950 | |||
| 1951 | static int probed = 0; | ||
| 1952 | |||
| 1950 | static int __devinit i7core_probe(struct pci_dev *pdev, | 1953 | static int __devinit i7core_probe(struct pci_dev *pdev, |
| 1951 | const struct pci_device_id *id) | 1954 | const struct pci_device_id *id) |
| 1952 | { | 1955 | { |
| 1953 | int dev_idx = id->driver_data; | ||
| 1954 | int rc; | 1956 | int rc; |
| 1955 | struct i7core_dev *i7core_dev; | 1957 | struct i7core_dev *i7core_dev; |
| 1956 | 1958 | ||
| 1959 | /* get the pci devices we want to reserve for our use */ | ||
| 1960 | mutex_lock(&i7core_edac_lock); | ||
| 1961 | |||
| 1957 | /* | 1962 | /* |
| 1958 | * All memory controllers are allocated at the first pass. | 1963 | * All memory controllers are allocated at the first pass. |
| 1959 | */ | 1964 | */ |
| 1960 | if (unlikely(dev_idx >= 1)) | 1965 | if (unlikely(probed >= 1)) { |
| 1966 | mutex_unlock(&i7core_edac_lock); | ||
| 1961 | return -EINVAL; | 1967 | return -EINVAL; |
| 1962 | 1968 | } | |
| 1963 | /* get the pci devices we want to reserve for our use */ | 1969 | probed++; |
| 1964 | mutex_lock(&i7core_edac_lock); | ||
| 1965 | 1970 | ||
| 1966 | rc = i7core_get_devices(pci_dev_table); | 1971 | rc = i7core_get_devices(pci_dev_table); |
| 1967 | if (unlikely(rc < 0)) | 1972 | if (unlikely(rc < 0)) |
| @@ -2033,6 +2038,8 @@ static void __devexit i7core_remove(struct pci_dev *pdev) | |||
| 2033 | i7core_dev->socket); | 2038 | i7core_dev->socket); |
| 2034 | } | 2039 | } |
| 2035 | } | 2040 | } |
| 2041 | probed--; | ||
| 2042 | |||
| 2036 | mutex_unlock(&i7core_edac_lock); | 2043 | mutex_unlock(&i7core_edac_lock); |
| 2037 | } | 2044 | } |
| 2038 | 2045 | ||
