2015-04-16 12:20:54

by weiyj_lk

[permalink] [raw]
Subject: [PATCH] powerpc/4xx: Fix return value check in hsta_msi_probe()

From: Wei Yongjun <[email protected]>

In case of error, the functions platform_get_resource() and kmalloc()
returns NULL not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.

Signed-off-by: Wei Yongjun <[email protected]>
---
arch/powerpc/sysdev/ppc4xx_hsta_msi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c b/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
index f366d2d..49e24f5 100644
--- a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
+++ b/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
@@ -130,7 +130,7 @@ static int hsta_msi_probe(struct platform_device *pdev)
int irq, ret, irq_count;

mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (IS_ERR(mem)) {
+ if (!mem) {
dev_err(dev, "Unable to get mmio space\n");
return -EINVAL;
}
@@ -155,7 +155,7 @@ static int hsta_msi_probe(struct platform_device *pdev)
goto out;

ppc4xx_hsta_msi.irq_map = kmalloc(sizeof(int) * irq_count, GFP_KERNEL);
- if (IS_ERR(ppc4xx_hsta_msi.irq_map)) {
+ if (!ppc4xx_hsta_msi.irq_map) {
ret = -ENOMEM;
goto out1;
}


2015-08-10 09:27:07

by Michael Ellerman

[permalink] [raw]
Subject: Re: powerpc/4xx: Fix return value check in hsta_msi_probe()

On Thu, 2015-16-04 at 12:18:50 UTC, [email protected] wrote:
> From: Wei Yongjun <[email protected]>
>
> In case of error, the functions platform_get_resource() and kmalloc()
> returns NULL not ERR_PTR(). The IS_ERR() test in the return value check
> should be replaced with NULL test.
>
> Signed-off-by: Wei Yongjun <[email protected]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/35a7f41cc6bb7013e344

cheers