Linux-EDAC Archive on lore.kernel.org
 help / color / Atom feed
From: Wei Yongjun <weiyongjun1@huawei.com>
To: Yash Shah <yash.shah@sifive.com>, 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 <rrichter@marvell.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	Paul Walmsley <paul.walmsley@sifive.com>
Cc: Wei Yongjun <weiyongjun1@huawei.com>,
	<linux-edac@vger.kernel.org>, <linux-riscv@lists.infradead.org>,
	<kernel-janitors@vger.kernel.org>
Subject: [PATCH]  EDAC/sifive: fix return value check in ecc_register()
Date: Wed, 15 Jan 2020 15:03:03 +0000
Message-ID: <20200115150303.112627-1-weiyongjun1@huawei.com> (raw)

In case of error, the function edac_device_alloc_ctl_info() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.

Fixes: 91abaeaaff35 ("EDAC/sifive: Add EDAC platform driver for SiFive SoCs")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/edac/sifive_edac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/edac/sifive_edac.c b/drivers/edac/sifive_edac.c
index c0cc72a3b2be..3a3dcb14ed99 100644
--- a/drivers/edac/sifive_edac.c
+++ b/drivers/edac/sifive_edac.c
@@ -54,8 +54,8 @@ static int ecc_register(struct platform_device *pdev)
 	p->dci = edac_device_alloc_ctl_info(0, "sifive_ecc", 1, "sifive_ecc",
 					    1, 1, NULL, 0,
 					    edac_device_alloc_index());
-	if (IS_ERR(p->dci))
-		return PTR_ERR(p->dci);
+	if (!p->dci)
+		return -ENOMEM;
 
 	p->dci->dev = &pdev->dev;
 	p->dci->mod_name = "Sifive ECC Manager";




             reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15 15:03 Wei Yongjun [this message]
2020-01-17  0:35 ` Borislav Petkov

Reply instructions:

You may reply publically 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=20200115150303.112627-1-weiyongjun1@huawei.com \
    --to=weiyongjun1@huawei.com \
    --cc=bp@alien8.de \
    --cc=james.morse@arm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=rrichter@marvell.com \
    --cc=tony.luck@intel.com \
    --cc=yash.shah@sifive.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

Linux-EDAC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-edac/0 linux-edac/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-edac linux-edac/ https://lore.kernel.org/linux-edac \
		linux-edac@vger.kernel.org
	public-inbox-index linux-edac

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-edac


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git