@@ -784,8 +784,10 @@ static int altr_edac_device_probe(struct platform_device *pdev)
dci->dev_name = drvdata->edac_dev_name;
res = edac_device_add_device(dci);
- if (res)
+ if (res) {
+ res = -ENXIO;
goto fail1;
+ }
altr_create_edacdev_dbgfs(dci, drvdata->data);
@@ -1555,7 +1557,7 @@ static int altr_portb_setup(struct altr_edac_device_dev *device)
if (rc) {
edac_printk(KERN_ERR, EDAC_DEVICE,
"edac_device_add_device portB failed\n");
- rc = -ENOMEM;
+ rc = -ENXIO;
goto err_release_group_1;
}
altr_create_edacdev_dbgfs(dci, prv);
@@ -1963,7 +1965,7 @@ static int altr_edac_a10_device_add(struct altr_arria10_edac *edac,
rc = edac_device_add_device(dci);
if (rc) {
dev_err(edac->dev, "edac_device_add_device failed\n");
- rc = -ENOMEM;
+ rc = -ENXIO;
goto err_release_group1;
}
@@ -388,6 +388,7 @@ static int amd8111_dev_probe(struct pci_dev *dev,
if (edac_device_add_device(dev_info->edac_dev) > 0) {
printk(KERN_ERR "failed to add edac_dev for %s\n",
dev_info->ctl_name);
+ ret = -ENXIO;
goto err_edac_free_ctl;
}
@@ -558,7 +558,7 @@ static int aurora_l2_probe(struct platform_device *pdev)
if (edac_device_add_device(dci)) {
edac_device_free_ctl_info(dci);
- return -EINVAL;
+ return -ENXIO;
}
#ifdef CONFIG_EDAC_DEBUG
@@ -90,8 +90,10 @@ static int highbank_l2_err_probe(struct platform_device *pdev)
dci->ctl_name = id ? id->compatible : "unknown";
dci->dev_name = dev_name(&pdev->dev);
- if (edac_device_add_device(dci))
+ if (edac_device_add_device(dci)) {
+ res = -ENXIO;
goto err;
+ }
drvdata->db_irq = platform_get_irq(pdev, 0);
res = devm_request_irq(&pdev->dev, drvdata->db_irq,
@@ -553,6 +553,7 @@ static int mpc85xx_l2_err_probe(struct platform_device *op)
if (edac_device_add_device(edac_dev) > 0) {
edac_dbg(3, "failed edac_device_add_device()\n");
+ res = -ENXIO;
goto err;
}
@@ -361,8 +361,10 @@ static int qcom_llcc_edac_probe(struct platform_device *pdev)
edev_ctl->pvt_info = llcc_driv_data;
rc = edac_device_add_device(edev_ctl);
- if (rc)
+ if (rc) {
+ rc = -ENXIO;
goto out_mem;
+ }
platform_set_drvdata(pdev, edev_ctl);
@@ -1421,6 +1421,7 @@ static int thunderx_ocx_probe(struct pci_dev *pdev,
ret = edac_device_add_device(edac_dev);
if (ret) {
dev_err(&pdev->dev, "Cannot add EDAC device: %d\n", ret);
+ ret = -ENXIO;
goto err_free;
}
@@ -2051,6 +2052,7 @@ static int thunderx_l2c_probe(struct pci_dev *pdev,
ret = edac_device_add_device(edac_dev);
if (ret) {
dev_err(&pdev->dev, "Cannot add EDAC device: %d\n", ret);
+ ret = -ENXIO;
goto err_free;
}
@@ -953,7 +953,7 @@ static int xgene_edac_pmd_add(struct xgene_edac *edac, struct device_node *np,
rc = edac_device_add_device(edac_dev);
if (rc > 0) {
dev_err(edac->dev, "edac_device_add_device failed\n");
- rc = -ENOMEM;
+ rc = -ENXIO;
goto err_free;
}
@@ -1236,7 +1236,7 @@ static int xgene_edac_l3_add(struct xgene_edac *edac, struct device_node *np,
rc = edac_device_add_device(edac_dev);
if (rc > 0) {
dev_err(edac->dev, "failed edac_device_add_device()\n");
- rc = -ENOMEM;
+ rc = -ENXIO;
goto err_ctl_free;
}
@@ -1774,7 +1774,7 @@ static int xgene_edac_soc_add(struct xgene_edac *edac, struct device_node *np,
rc = edac_device_add_device(edac_dev);
if (rc > 0) {
dev_err(edac->dev, "failed edac_device_add_device()\n");
- rc = -ENOMEM;
+ rc = -ENXIO;
goto err_ctl_free;
}
When edac_device_add_device() fails, fix to return -ENXIO from the error handling case instead of 0, -ENOMEM or -EINVAL. Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> --- drivers/edac/altera_edac.c | 8 +++++--- drivers/edac/amd8111_edac.c | 1 + drivers/edac/armada_xp_edac.c | 2 +- drivers/edac/highbank_l2_edac.c | 4 +++- drivers/edac/mpc85xx_edac.c | 1 + drivers/edac/qcom_edac.c | 4 +++- drivers/edac/thunderx_edac.c | 2 ++ drivers/edac/xgene_edac.c | 6 +++--- 8 files changed, 19 insertions(+), 9 deletions(-)