linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]  EDAC/sifive: fix return value check in ecc_register()
@ 2020-01-15 15:03 Wei Yongjun
  2020-01-17  0:35 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2020-01-15 15:03 UTC (permalink / raw)
  To: Yash Shah, Borislav Petkov, Mauro Carvalho Chehab, Tony Luck,
	James Morse, Robert Richter, Palmer Dabbelt, Paul Walmsley
  Cc: Wei Yongjun, linux-edac, linux-riscv, kernel-janitors

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";




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH]  EDAC/sifive: fix return value check in ecc_register()
  2020-01-15 15:03 [PATCH] EDAC/sifive: fix return value check in ecc_register() Wei Yongjun
@ 2020-01-17  0:35 ` Borislav Petkov
  0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2020-01-17  0:35 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Yash Shah, Mauro Carvalho Chehab, Tony Luck, James Morse,
	Robert Richter, Palmer Dabbelt, Paul Walmsley, linux-edac,
	linux-riscv, kernel-janitors

On Wed, Jan 15, 2020 at 03:03:03PM +0000, Wei Yongjun wrote:
> 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";

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-17  0:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15 15:03 [PATCH] EDAC/sifive: fix return value check in ecc_register() Wei Yongjun
2020-01-17  0:35 ` Borislav Petkov

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