[PATCH v2 1/3] edac: Fix error return code when edac_pci_add_device() fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux