linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhen Lei <thunder.leizhen@huawei.com>
To: Borislav Petkov <bp@alien8.de>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Tony Luck <tony.luck@intel.com>,
	James Morse <james.morse@arm.com>,
	Robert Richter <rric@kernel.org>,
	Johannes Thumshirn <morbidrsa@gmail.com>,
	Ralf Baechle <ralf@linux-mips.org>,
	Dinh Nguyen <dinguyen@kernel.org>,
	Jan Luebbe <jlu@pengutronix.de>,
	Andre Przywara <andre.przywara@arm.com>,
	Channagoud Kadabi <ckadabi@codeaurora.org>,
	"Venkata Narendra Kumar Gutta" <vnkgutta@codeaurora.org>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	"Khuong Dinh" <khuong@os.amperecomputing.com>,
	York Sun <york.sun@nxp.com>,
	linux-edac <linux-edac@vger.kernel.org>,
	linux-mips <linux-mips@vger.kernel.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Cc: Zhen Lei <thunder.leizhen@huawei.com>
Subject: [PATCH v2 1/3] edac: Fix error return code when edac_pci_add_device() fails
Date: Mon, 31 May 2021 22:53:00 +0800	[thread overview]
Message-ID: <20210531145302.9655-2-thunder.leizhen@huawei.com> (raw)
In-Reply-To: <20210531145302.9655-1-thunder.leizhen@huawei.com>

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(-)

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



  reply	other threads:[~2021-05-31 14:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31 14:52 [PATCH v2 0/3] edac: Fix error return code when edac_pci_add_device() or edac_device_add_device() fails Zhen Lei
2021-05-31 14:53 ` Zhen Lei [this message]
2021-05-31 14:53 ` [PATCH v2 2/3] edac: Fix error return code when " Zhen Lei
2021-05-31 14:53 ` [PATCH v2 3/3] edac: Use 'ret' instead of 'res' to store the return value Zhen Lei
2021-05-31 14:57   ` Borislav Petkov
2021-06-01  1:40     ` Leizhen (ThunderTown)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210531145302.9655-2-thunder.leizhen@huawei.com \
    --to=thunder.leizhen@huawei.com \
    --cc=agross@kernel.org \
    --cc=andre.przywara@arm.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=bp@alien8.de \
    --cc=ckadabi@codeaurora.org \
    --cc=dinguyen@kernel.org \
    --cc=james.morse@arm.com \
    --cc=jlu@pengutronix.de \
    --cc=khuong@os.amperecomputing.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=morbidrsa@gmail.com \
    --cc=ralf@linux-mips.org \
    --cc=rric@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=vnkgutta@codeaurora.org \
    --cc=york.sun@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).