[PATCH -next] pinctrl: nuvoton: Fix return value check in wpcm450_gpio_register()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Fixes: a1d1e0e3d80a ("pinctrl: nuvoton: Add driver for WPCM450")
Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
Signed-off-by: Jialin Zhang <zhangjialin11@xxxxxxxxxx>
---
 drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
index 661aa963e3fc..a71b684b9b44 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
@@ -1019,8 +1019,9 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
 	int ret;
 
 	pctrl->gpio_base = devm_platform_ioremap_resource(pdev, 0);
-	if (!pctrl->gpio_base)
-		return dev_err_probe(dev, -ENOMEM, "Resource fail for GPIO controller\n");
+	if (IS_ERR(pctrl->gpio_base))
+		return dev_err_probe(dev, PTR_ERR(pctrl->gpio_base),
+				     "Resource fail for GPIO controller\n");
 
 	device_for_each_child_node(dev, child)  {
 		void __iomem *dat = NULL;
-- 
2.25.1




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux