linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] gpio: aspeed: fix return value check in aspeed_gpio_probe()
@ 2016-09-15  1:30 Wei Yongjun
  2016-09-15  1:48 ` Joel Stanley
  2016-09-15 12:24 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2016-09-15  1:30 UTC (permalink / raw)
  To: Joel Stanley, Linus Walleij, Alexandre Courbot; +Cc: Wei Yongjun, linux-gpio

From: Wei Yongjun <weiyongjun1@huawei.com>

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 <weiyongjun1@huawei.com>
---
 drivers/gpio/gpio-aspeed.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index 9f7266e..8aa3406 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -413,8 +413,8 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
 		return -ENXIO;
 
 	gpio->base = devm_ioremap_resource(&pdev->dev, res);
-	if (!gpio->base)
-		return -ENOMEM;
+	if (IS_ERR(gpio->base))
+		return PTR_ERR(gpio->base);
 
 	spin_lock_init(&gpio->lock);
 




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

end of thread, other threads:[~2016-09-15 12:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-15  1:30 [PATCH -next] gpio: aspeed: fix return value check in aspeed_gpio_probe() Wei Yongjun
2016-09-15  1:48 ` Joel Stanley
2016-09-15 12:24 ` Linus Walleij

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