diff options
author | Borislav Petkov <borislav.petkov@amd.com> | 2009-12-21 12:13:01 -0500 |
---|---|---|
committer | Borislav Petkov <borislav.petkov@amd.com> | 2009-12-24 05:07:07 -0500 |
commit | 56b34b91e22313294154cee0c16e294cf8a45b61 (patch) | |
tree | 59ae221911c7bef88711ba3054204e99d47f93a6 /drivers | |
parent | 8f68ed9728193b1f2fb53ba06031b06bd8b3d1b4 (diff) |
amd64_edac: make driver loading more robust
Currently, the module does not initialize fully when the DIMMs aren't
ECC but remains still loaded. Propagate the error when no instance of
the driver is properly initialized and prevent further loading.
Reorganize and polish error handling in amd64_edac_init() while at it.
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/edac/amd64_edac.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index fb0d36b47411..a8af27a74825 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
@@ -3014,25 +3014,29 @@ static void amd64_setup_pci_device(void) | |||
3014 | static int __init amd64_edac_init(void) | 3014 | static int __init amd64_edac_init(void) |
3015 | { | 3015 | { |
3016 | int nb, err = -ENODEV; | 3016 | int nb, err = -ENODEV; |
3017 | bool load_ok = false; | ||
3017 | 3018 | ||
3018 | edac_printk(KERN_INFO, EDAC_MOD_STR, EDAC_AMD64_VERSION "\n"); | 3019 | edac_printk(KERN_INFO, EDAC_MOD_STR, EDAC_AMD64_VERSION "\n"); |
3019 | 3020 | ||
3020 | opstate_init(); | 3021 | opstate_init(); |
3021 | 3022 | ||
3022 | if (cache_k8_northbridges() < 0) | 3023 | if (cache_k8_northbridges() < 0) |
3023 | return err; | 3024 | goto err_ret; |
3024 | 3025 | ||
3025 | msrs = msrs_alloc(); | 3026 | msrs = msrs_alloc(); |
3027 | if (!msrs) | ||
3028 | goto err_ret; | ||
3026 | 3029 | ||
3027 | err = pci_register_driver(&amd64_pci_driver); | 3030 | err = pci_register_driver(&amd64_pci_driver); |
3028 | if (err) | 3031 | if (err) |
3029 | return err; | 3032 | goto err_pci; |
3030 | 3033 | ||
3031 | /* | 3034 | /* |
3032 | * At this point, the array 'pvt_lookup[]' contains pointers to alloc'd | 3035 | * At this point, the array 'pvt_lookup[]' contains pointers to alloc'd |
3033 | * amd64_pvt structs. These will be used in the 2nd stage init function | 3036 | * amd64_pvt structs. These will be used in the 2nd stage init function |
3034 | * to finish initialization of the MC instances. | 3037 | * to finish initialization of the MC instances. |
3035 | */ | 3038 | */ |
3039 | err = -ENODEV; | ||
3036 | for (nb = 0; nb < num_k8_northbridges; nb++) { | 3040 | for (nb = 0; nb < num_k8_northbridges; nb++) { |
3037 | if (!pvt_lookup[nb]) | 3041 | if (!pvt_lookup[nb]) |
3038 | continue; | 3042 | continue; |
@@ -3040,16 +3044,21 @@ static int __init amd64_edac_init(void) | |||
3040 | err = amd64_init_2nd_stage(pvt_lookup[nb]); | 3044 | err = amd64_init_2nd_stage(pvt_lookup[nb]); |
3041 | if (err) | 3045 | if (err) |
3042 | goto err_2nd_stage; | 3046 | goto err_2nd_stage; |
3043 | } | ||
3044 | 3047 | ||
3045 | amd64_setup_pci_device(); | 3048 | load_ok = true; |
3049 | } | ||
3046 | 3050 | ||
3047 | return 0; | 3051 | if (load_ok) { |
3052 | amd64_setup_pci_device(); | ||
3053 | return 0; | ||
3054 | } | ||
3048 | 3055 | ||
3049 | err_2nd_stage: | 3056 | err_2nd_stage: |
3050 | debugf0("2nd stage failed\n"); | ||
3051 | pci_unregister_driver(&amd64_pci_driver); | 3057 | pci_unregister_driver(&amd64_pci_driver); |
3052 | 3058 | err_pci: | |
3059 | msrs_free(msrs); | ||
3060 | msrs = NULL; | ||
3061 | err_ret: | ||
3053 | return err; | 3062 | return err; |
3054 | } | 3063 | } |
3055 | 3064 | ||