EDAC, amd64: Save and return err code from probe_one_instance()

We should save the return code from probe_one_instance() so that it can
be returned from the module init function. Otherwise, we'll be returning
the -ENOMEM from above.

Signed-off-by: Yazen Ghannam <[email protected]>
Cc: linux-edac <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Borislav Petkov <[email protected]>
This commit is contained in:
Yazen Ghannam 2017-01-13 09:52:19 -06:00 • committed by Borislav Petkov
commit 2287c63643

View file

@ -3466,14 +3466,16 @@ static int __init amd64_edac_init(void)
if (!msrs)
goto err_free;
for (i = 0; i < amd_nb_num(); i++)
if (probe_one_instance(i)) {
for (i = 0; i < amd_nb_num(); i++) {
err = probe_one_instance(i);
if (err) {
/* unwind properly */
while (--i >= 0)
remove_one_instance(i);
goto err_pci;
}
}
setup_pci_device();