lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210531145302.9655-2-thunder.leizhen@huawei.com>
Date:   Mon, 31 May 2021 22:53:00 +0800
From:   Zhen Lei <thunder.leizhen@...wei.com>
To:     Borislav Petkov <bp@...en8.de>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Tony Luck <tony.luck@...el.com>,
        James Morse <james.morse@....com>,
        Robert Richter <rric@...nel.org>,
        Johannes Thumshirn <morbidrsa@...il.com>,
        Ralf Baechle <ralf@...ux-mips.org>,
        Dinh Nguyen <dinguyen@...nel.org>,
        Jan Luebbe <jlu@...gutronix.de>,
        Andre Przywara <andre.przywara@....com>,
        Channagoud Kadabi <ckadabi@...eaurora.org>,
        "Venkata Narendra Kumar Gutta" <vnkgutta@...eaurora.org>,
        Andy Gross <agross@...nel.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        "Khuong Dinh" <khuong@...amperecomputing.com>,
        York Sun <york.sun@....com>,
        linux-edac <linux-edac@...r.kernel.org>,
        linux-mips <linux-mips@...r.kernel.org>,
        linux-arm-msm <linux-arm-msm@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>
CC:     Zhen Lei <thunder.leizhen@...wei.com>
Subject: [PATCH v2 1/3] edac: Fix error return code when edac_pci_add_device() fails

When edac_pci_add_device() fails, fix to return -ENODEV from the error
handling case instead of 0.

The "goto err" in octeon_pci_probe() is removed to simplify code.

Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
---
 drivers/edac/amd8111_edac.c    | 1 +
 drivers/edac/mpc85xx_edac.c    | 1 +
 drivers/edac/octeon_edac-pci.c | 9 ++-------
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/edac/amd8111_edac.c b/drivers/edac/amd8111_edac.c
index 7508aa416ddbd7b..16b28da6489177a 100644
--- a/drivers/edac/amd8111_edac.c
+++ b/drivers/edac/amd8111_edac.c
@@ -480,6 +480,7 @@ static int amd8111_pci_probe(struct pci_dev *dev,
 	if (edac_pci_add_device(pci_info->edac_dev, pci_info->edac_idx) > 0) {
 		printk(KERN_ERR "failed to add edac_pci for %s\n",
 			pci_info->ctl_name);
+		ret = -ENODEV;
 		goto err_edac_free_ctl;
 	}
 
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index 67f7bc3fe5b3b62..312de75e66b851e 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -248,6 +248,7 @@ static int mpc85xx_pci_err_probe(struct platform_device *op)
 
 	if (edac_pci_add_device(pci, pdata->edac_idx) > 0) {
 		edac_dbg(3, "failed edac_pci_add_device()\n");
+		res = -ENODEV;
 		goto err;
 	}
 
diff --git a/drivers/edac/octeon_edac-pci.c b/drivers/edac/octeon_edac-pci.c
index 28b238eecefcc9d..07995de4ea703ee 100644
--- a/drivers/edac/octeon_edac-pci.c
+++ b/drivers/edac/octeon_edac-pci.c
@@ -60,7 +60,6 @@ static void octeon_pci_poll(struct edac_pci_ctl_info *pci)
 static int octeon_pci_probe(struct platform_device *pdev)
 {
 	struct edac_pci_ctl_info *pci;
-	int res = 0;
 
 	pci = edac_pci_alloc_ctl_info(0, "octeon_pci_err");
 	if (!pci)
@@ -76,15 +75,11 @@ static int octeon_pci_probe(struct platform_device *pdev)
 
 	if (edac_pci_add_device(pci, 0) > 0) {
 		pr_err("%s: edac_pci_add_device() failed\n", __func__);
-		goto err;
+		edac_pci_free_ctl_info(pci);
+		return -ENODEV;
 	}
 
 	return 0;
-
-err:
-	edac_pci_free_ctl_info(pci);
-
-	return res;
 }
 
 static int octeon_pci_remove(struct platform_device *pdev)
-- 
2.26.0.106.g9fadedd


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ