@@ -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;
}
@@ -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;
}
@@ -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)
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@huawei.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(-)