summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2021-06-08 17:38:53 +0300
committerBartosz Golaszewski <bgolaszewski@baylibre.com>2021-06-11 21:57:59 +0300
commit622096fdff79458436b7387a86a5c9f000785e4f (patch)
tree15a9b862d0c12f790d3f77bd2c09155e59f54f38 /drivers/gpio
parent354cb6465a9b04df1e99a43fdd22881ad5c91843 (diff)
downloadlinux-622096fdff79458436b7387a86a5c9f000785e4f.tar.xz
gpio: idt3243x: Fix return value check in idt_gpio_probe()
In case of error, the function devm_platform_ioremap_resource_byname() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: 4195926aedca ("gpio: Add support for IDT 79RC3243x GPIO controller") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-idt3243x.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpio/gpio-idt3243x.c b/drivers/gpio/gpio-idt3243x.c
index e961acee1571..50003ad2e589 100644
--- a/drivers/gpio/gpio-idt3243x.c
+++ b/drivers/gpio/gpio-idt3243x.c
@@ -142,8 +142,8 @@ static int idt_gpio_probe(struct platform_device *pdev)
return -ENOMEM;
ctrl->gpio = devm_platform_ioremap_resource_byname(pdev, "gpio");
- if (!ctrl->gpio)
- return -ENOMEM;
+ if (IS_ERR(ctrl->gpio))
+ return PTR_ERR(ctrl->gpio);
ctrl->gc.parent = dev;
@@ -160,8 +160,8 @@ static int idt_gpio_probe(struct platform_device *pdev)
if (device_property_read_bool(dev, "interrupt-controller")) {
ctrl->pic = devm_platform_ioremap_resource_byname(pdev, "pic");
- if (!ctrl->pic)
- return -ENOMEM;
+ if (IS_ERR(ctrl->pic))
+ return PTR_ERR(ctrl->pic);
parent_irq = platform_get_irq(pdev, 0);
if (!parent_irq)