EDAC, amd64: Save and return err code from probe_one_instance()
authorYazen Ghannam <Yazen.Ghannam@amd.com>
Fri, 13 Jan 2017 15:52:19 +0000 (09:52 -0600)
committerBorislav Petkov <bp@suse.de>
Mon, 16 Jan 2017 10:53:39 +0000 (11:53 +0100)
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 <Yazen.Ghannam@amd.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Link: http://lkml.kernel.org/r/1484322741-41884-1-git-send-email-Yazen.Ghannam@amd.com
Signed-off-by: Borislav Petkov <bp@suse.de>
drivers/edac/amd64_edac.c

index 26025117783087541af87e31b4e3d57a0e20cf21..4a480da713b9bfc19b470dc9988335fd821c7c0c 100644 (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();