diff options
author | Dave Peterson <dsp@llnl.gov> | 2006-03-26 04:38:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-26 11:57:06 -0500 |
commit | e8a491b401dbbc5af9fe6483dc558d76343bfbb3 (patch) | |
tree | bdc79f181103a01a6d5b3af0476a5328db0c4edb /drivers/edac/i82860_edac.c | |
parent | 3847bccce80c8a01d7adbad9961564252207302a (diff) |
[PATCH] EDAC: i82860 cleanup
- Fix i82860_init() so it cleans up properly on failure.
- Fix i82860_exit() so it cleans up properly.
- Fix typo in comment (i.e. www.redhat.com.com).
Signed-off-by: David S. Peterson <dsp@llnl.gov>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/edac/i82860_edac.c')
-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"); |