]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
EDAC/ie31200: Fix the error path order of ie31200_init()
authorQiuxu Zhuo <qiuxu.zhuo@intel.com>
Mon, 10 Mar 2025 01:14:03 +0000 (09:14 +0800)
committerTony Luck <tony.luck@intel.com>
Mon, 10 Mar 2025 17:43:39 +0000 (10:43 -0700)
The error path order of ie31200_init() is incorrect, fix it.

Fixes: 709ed1bcef12 ("EDAC/ie31200: Fallback if host bridge device is already initialized")
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Tested-by: Gary Wang <gary.c.wang@intel.com>
Link: https://lore.kernel.org/r/20250310011411.31685-4-qiuxu.zhuo@intel.com
drivers/edac/ie31200_edac.c

index 2886866cb457a932577defb283b1f0a421aa782b..a8dd55ec52cea19478a73cd2fa11a4b5d63d1d6d 100644 (file)
@@ -619,7 +619,7 @@ static int __init ie31200_init(void)
 
        pci_rc = pci_register_driver(&ie31200_driver);
        if (pci_rc < 0)
-               goto fail0;
+               return pci_rc;
 
        if (!mci_pdev) {
                ie31200_registered = 0;
@@ -630,11 +630,13 @@ static int __init ie31200_init(void)
                        if (mci_pdev)
                                break;
                }
+
                if (!mci_pdev) {
                        edac_dbg(0, "ie31200 pci_get_device fail\n");
                        pci_rc = -ENODEV;
-                       goto fail1;
+                       goto fail0;
                }
+
                pci_rc = ie31200_init_one(mci_pdev, &ie31200_pci_tbl[i]);
                if (pci_rc < 0) {
                        edac_dbg(0, "ie31200 init fail\n");
@@ -642,12 +644,12 @@ static int __init ie31200_init(void)
                        goto fail1;
                }
        }
-       return 0;
 
+       return 0;
 fail1:
-       pci_unregister_driver(&ie31200_driver);
-fail0:
        pci_dev_put(mci_pdev);
+fail0:
+       pci_unregister_driver(&ie31200_driver);
 
        return pci_rc;
 }