[PATCH] ARM: zx: Fix return value check in zx296702_pd_probe()

Subsystems: arm port, the rest

STALE3826d

2 messages, 2 authors, 2016-02-09 · open the first message on its own page

[PATCH] ARM: zx: Fix return value check in zx296702_pd_probe()

From: <hidden>
Date: 2016-02-06 14:26:50

From: Wei Yongjun <redacted>

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

Signed-off-by: Wei Yongjun <redacted>
---
 arch/arm/mach-zx/zx296702-pm-domain.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-zx/zx296702-pm-domain.c b/arch/arm/mach-zx/zx296702-pm-domain.c
index e08574d..2037bcb 100644
--- a/arch/arm/mach-zx/zx296702-pm-domain.c
+++ b/arch/arm/mach-zx/zx296702-pm-domain.c
@@ -169,9 +169,9 @@ static int zx296702_pd_probe(struct platform_device *pdev)
 	}
 
 	pcubase = devm_ioremap_resource(&pdev->dev, res);
-	if (!pcubase) {
+	if (IS_ERR(pcubase)) {
 		dev_err(&pdev->dev, "ioremap fail.\n");
-		return -EIO;
+		return PTR_ERR(pcubase);
 	}
 
 	for (i = 0; i < ARRAY_SIZE(zx296702_pm_domains); ++i)

Re: [PATCH] ARM: zx: Fix return value check in zx296702_pd_probe()

From: Jun Nie <hidden>
Date: 2016-02-09 05:03:52

On 2016?02?06? 22:24, weiyj_lk at 163.com wrote:
quoted hunk
From: Wei Yongjun <redacted>

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

Signed-off-by: Wei Yongjun <redacted>
---
  arch/arm/mach-zx/zx296702-pm-domain.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-zx/zx296702-pm-domain.c b/arch/arm/mach-zx/zx296702-pm-domain.c
index e08574d..2037bcb 100644
--- a/arch/arm/mach-zx/zx296702-pm-domain.c
+++ b/arch/arm/mach-zx/zx296702-pm-domain.c
@@ -169,9 +169,9 @@ static int zx296702_pd_probe(struct platform_device *pdev)
  	}

  	pcubase = devm_ioremap_resource(&pdev->dev, res);
-	if (!pcubase) {
+	if (IS_ERR(pcubase)) {
  		dev_err(&pdev->dev, "ioremap fail.\n");
-		return -EIO;
+		return PTR_ERR(pcubase);
  	}

  	for (i = 0; i < ARRAY_SIZE(zx296702_pm_domains); ++i)
Thanks for fixing this issue.
Reviewed-by: Jun Nie <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help