Skip to contentSkip to conversation

watchdog: tqmx86: Fix a couple IS_ERR() vs NULL bugs

PATCH In review Dan Carpenter 3 participants 3 messages Jan 4, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog: tqmx86: Fix a couple IS_ERR() vs NULL bugs

These functions return NULL on error but we accidentally check for IS_ERR() instead.

Fixes e3c21e088f89 ("watchdog: tqmx86: Add watchdog driver for the IO controller")
---
 drivers/watchdog/tqmx86_wdt.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/watchdog/tqmx86_wdt.c +4 -4
index 0d3a0fbbd7a5..52941207a12a 100644
@@ -79,13 +79,13 @@ static int tqmx86_wdt_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
-	if (IS_ERR(res))
-		return PTR_ERR(res);
+	if (!res)
+		return -ENODEV;
 
 	priv->io_base = devm_ioport_map(&pdev->dev, res->start,
 					resource_size(res));
-	if (IS_ERR(priv->io_base))
-		return PTR_ERR(priv->io_base);
+	if (!priv->io_base)
+		return -ENOMEM;
 
 	watchdog_set_drvdata(&priv->wdd, priv);
 
Signature · 1 line
2.17.1
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Dan Carpenter
Quoted 5 lines · Dan Carpenter

These functions return NULL on error but we accidentally check for IS_ERR() instead.

Fixes e3c21e088f89 ("watchdog: tqmx86: Add watchdog driver for the IO controller")
Quoted 27 lines
---
  drivers/watchdog/tqmx86_wdt.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/watchdog/tqmx86_wdt.c +4 -4
index 0d3a0fbbd7a5..52941207a12a 100644
@@ -79,13 +79,13 @@ static int tqmx86_wdt_probe(struct platform_device *pdev)
  		return -ENOMEM;
 
  	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
-	if (IS_ERR(res))
-		return PTR_ERR(res);
+	if (!res)
+		return -ENODEV;
 
  	priv->io_base = devm_ioport_map(&pdev->dev, res->start,
  					resource_size(res));
-	if (IS_ERR(priv->io_base))
-		return PTR_ERR(priv->io_base);
+	if (!priv->io_base)
+		return -ENOMEM;
 
  	watchdog_set_drvdata(&priv->wdd, priv);