[PATCH -next] pwm: samsung: fix return value check in pwm_samsung_probe()

Wei Yongjun weiyj.lk at gmail.com
Wed Jun 26 08:55:18 EST 2013


From: Wei Yongjun <yongjun_wei at trendmicro.com.cn>

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 <yongjun_wei at trendmicro.com.cn>
---
 drivers/pwm/pwm-samsung.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
index 2eb5439..6689c55 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c
@@ -482,8 +482,8 @@ static int pwm_samsung_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	chip->base = devm_ioremap_resource(&pdev->dev, res);
-	if (!chip->base)
-		return -ENOMEM;
+	if (IS_ERR(chip->base))
+		return PTR_ERR(chip->base);
 
 	chip->base_clk = devm_clk_get(&pdev->dev, "timers");
 	if (IS_ERR(chip->base_clk)) {



More information about the devicetree-discuss mailing list