Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wei Yongjun and committed by
Bartosz Golaszewski
622096fd 354cb646

+4 -4
+4 -4
drivers/gpio/gpio-idt3243x.c
··· 142 142 return -ENOMEM; 143 143 144 144 ctrl->gpio = devm_platform_ioremap_resource_byname(pdev, "gpio"); 145 - if (!ctrl->gpio) 146 - return -ENOMEM; 145 + if (IS_ERR(ctrl->gpio)) 146 + return PTR_ERR(ctrl->gpio); 147 147 148 148 ctrl->gc.parent = dev; 149 149 ··· 160 160 161 161 if (device_property_read_bool(dev, "interrupt-controller")) { 162 162 ctrl->pic = devm_platform_ioremap_resource_byname(pdev, "pic"); 163 - if (!ctrl->pic) 164 - return -ENOMEM; 163 + if (IS_ERR(ctrl->pic)) 164 + return PTR_ERR(ctrl->pic); 165 165 166 166 parent_irq = platform_get_irq(pdev, 0); 167 167 if (!parent_irq)