Skip to content

Commit 6cd1845

Browse files
Wei Yongjunsuryasaimadhu
authored andcommitted
EDAC/sifive: Fix return value check in ecc_register()
In case of error, the function edac_device_alloc_ctl_info() returns a NULL pointer, not ERR_PTR(). Replace the IS_ERR() test in the return value check with a NULL test. Fixes: 91abaea ("EDAC/sifive: Add EDAC platform driver for SiFive SoCs") Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent a651c6c commit 6cd1845

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/edac/sifive_edac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ static int ecc_register(struct platform_device *pdev)
5454
p->dci = edac_device_alloc_ctl_info(0, "sifive_ecc", 1, "sifive_ecc",
5555
1, 1, NULL, 0,
5656
edac_device_alloc_index());
57-
if (IS_ERR(p->dci))
58-
return PTR_ERR(p->dci);
57+
if (!p->dci)
58+
return -ENOMEM;
5959

6060
p->dci->dev = &pdev->dev;
6161
p->dci->mod_name = "Sifive ECC Manager";

0 commit comments

Comments
 (0)