diff options
-rw-r--r-- | drivers/edac/i82860_edac.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/edac/i82860_edac.c b/drivers/edac/i82860_edac.c index b0c05ad73067..e832778fc603 100644 --- a/drivers/edac/i82860_edac.c +++ b/drivers/edac/i82860_edac.c | |||
@@ -62,8 +62,6 @@ static const struct i82860_dev_info i82860_devs[] = { | |||
62 | static struct pci_dev *mci_pdev = NULL; /* init dev: in case that AGP code | 62 | static struct pci_dev *mci_pdev = NULL; /* init dev: in case that AGP code |
63 | has already registered driver */ | 63 | has already registered driver */ |
64 | 64 | ||
65 | static int i82860_registered = 1; | ||
66 | |||
67 | static void i82860_get_error_info (struct mem_ctl_info *mci, | 65 | static void i82860_get_error_info (struct mem_ctl_info *mci, |
68 | struct i82860_error_info *info) | 66 | struct i82860_error_info *info) |
69 | { | 67 | { |
@@ -265,24 +263,33 @@ static int __init i82860_init(void) | |||
265 | 263 | ||
266 | debugf3("%s()\n", __func__); | 264 | debugf3("%s()\n", __func__); |
267 | if ((pci_rc = pci_register_driver(&i82860_driver)) < 0) | 265 | if ((pci_rc = pci_register_driver(&i82860_driver)) < 0) |
268 | return pci_rc; | 266 | goto fail0; |
269 | 267 | ||
270 | if (!mci_pdev) { | 268 | if (!mci_pdev) { |
271 | i82860_registered = 0; | ||
272 | mci_pdev = pci_get_device(PCI_VENDOR_ID_INTEL, | 269 | mci_pdev = pci_get_device(PCI_VENDOR_ID_INTEL, |
273 | PCI_DEVICE_ID_INTEL_82860_0, NULL); | 270 | PCI_DEVICE_ID_INTEL_82860_0, NULL); |
274 | if (mci_pdev == NULL) { | 271 | if (mci_pdev == NULL) { |
275 | debugf0("860 pci_get_device fail\n"); | 272 | debugf0("860 pci_get_device fail\n"); |
276 | return -ENODEV; | 273 | pci_rc = -ENODEV; |
274 | goto fail1; | ||
277 | } | 275 | } |
278 | pci_rc = i82860_init_one(mci_pdev, i82860_pci_tbl); | 276 | pci_rc = i82860_init_one(mci_pdev, i82860_pci_tbl); |
279 | if (pci_rc < 0) { | 277 | if (pci_rc < 0) { |
280 | debugf0("860 init fail\n"); | 278 | debugf0("860 init fail\n"); |
281 | pci_dev_put(mci_pdev); | 279 | pci_rc = -ENODEV; |
282 | return -ENODEV; | 280 | goto fail1; |
283 | } | 281 | } |
284 | } | 282 | } |
285 | return 0; | 283 | return 0; |
284 | |||
285 | fail1: | ||
286 | pci_unregister_driver(&i82860_driver); | ||
287 | |||
288 | fail0: | ||
289 | if (mci_pdev != NULL) | ||
290 | pci_dev_put(mci_pdev); | ||
291 | |||
292 | return pci_rc; | ||
286 | } | 293 | } |
287 | 294 | ||
288 | static void __exit i82860_exit(void) | 295 | static void __exit i82860_exit(void) |
@@ -290,10 +297,9 @@ static void __exit i82860_exit(void) | |||
290 | debugf3("%s()\n", __func__); | 297 | debugf3("%s()\n", __func__); |
291 | 298 | ||
292 | pci_unregister_driver(&i82860_driver); | 299 | pci_unregister_driver(&i82860_driver); |
293 | if (!i82860_registered) { | 300 | |
294 | i82860_remove_one(mci_pdev); | 301 | if (mci_pdev != NULL) |
295 | pci_dev_put(mci_pdev); | 302 | pci_dev_put(mci_pdev); |
296 | } | ||
297 | } | 303 | } |
298 | 304 | ||
299 | module_init(i82860_init); | 305 | module_init(i82860_init); |
@@ -301,5 +307,5 @@ module_exit(i82860_exit); | |||
301 | 307 | ||
302 | MODULE_LICENSE("GPL"); | 308 | MODULE_LICENSE("GPL"); |
303 | MODULE_AUTHOR | 309 | MODULE_AUTHOR |
304 | ("Red Hat Inc. (http://www.redhat.com.com) Ben Woodard <woodard@redhat.com>"); | 310 | ("Red Hat Inc. (http://www.redhat.com) Ben Woodard <woodard@redhat.com>"); |
305 | MODULE_DESCRIPTION("ECC support for Intel 82860 memory hub controllers"); | 311 | MODULE_DESCRIPTION("ECC support for Intel 82860 memory hub controllers"); |