Linux-Watchdog Archive on lore.kernel.org
 help / Atom feed
* [PATCH] watchdog: tqmx86: Fix a couple IS_ERR() vs NULL bugs
@ 2019-01-04  6:47 Dan Carpenter
  2019-01-04 13:11 ` Andrew Lunn
  2019-01-04 13:52 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-01-04  6:47 UTC (permalink / raw)
  To: Wim Van Sebroeck, Andrew Lunn
  Cc: Guenter Roeck, linux-watchdog, kernel-janitors

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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/watchdog/tqmx86_wdt.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/tqmx86_wdt.c b/drivers/watchdog/tqmx86_wdt.c
index 0d3a0fbbd7a5..52941207a12a 100644
--- a/drivers/watchdog/tqmx86_wdt.c
+++ b/drivers/watchdog/tqmx86_wdt.c
@@ -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);
 
-- 
2.17.1


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

* Re: [PATCH] watchdog: tqmx86: Fix a couple IS_ERR() vs NULL bugs
  2019-01-04  6:47 [PATCH] watchdog: tqmx86: Fix a couple IS_ERR() vs NULL bugs Dan Carpenter
@ 2019-01-04 13:11 ` Andrew Lunn
  2019-01-04 13:52 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2019-01-04 13:11 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Wim Van Sebroeck, Guenter Roeck, linux-watchdog, kernel-janitors

On Fri, Jan 04, 2019 at 09:47:25AM +0300, Dan Carpenter wrote:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH] watchdog: tqmx86: Fix a couple IS_ERR() vs NULL bugs
  2019-01-04  6:47 [PATCH] watchdog: tqmx86: Fix a couple IS_ERR() vs NULL bugs Dan Carpenter
  2019-01-04 13:11 ` Andrew Lunn
@ 2019-01-04 13:52 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2019-01-04 13:52 UTC (permalink / raw)
  To: Dan Carpenter, Wim Van Sebroeck, Andrew Lunn
  Cc: linux-watchdog, kernel-janitors

On 1/3/19 10:47 PM, Dan Carpenter wrote:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/watchdog/tqmx86_wdt.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/tqmx86_wdt.c b/drivers/watchdog/tqmx86_wdt.c
> index 0d3a0fbbd7a5..52941207a12a 100644
> --- a/drivers/watchdog/tqmx86_wdt.c
> +++ b/drivers/watchdog/tqmx86_wdt.c
> @@ -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);
>   
> 


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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-04  6:47 [PATCH] watchdog: tqmx86: Fix a couple IS_ERR() vs NULL bugs Dan Carpenter
2019-01-04 13:11 ` Andrew Lunn
2019-01-04 13:52 ` Guenter Roeck

Linux-Watchdog Archive on lore.kernel.org

Archives are clonable: git clone --mirror https://lore.kernel.org/linux-watchdog/0 linux-watchdog/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-watchdog linux-watchdog/ https://lore.kernel.org/linux-watchdog \
		linux-watchdog@vger.kernel.org linux-watchdog@archiver.kernel.org
	public-inbox-index linux-watchdog


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-watchdog


AGPL code for this site: git clone https://public-inbox.org/ public-inbox