All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] watchdog: pic32-wdt: Fix return value check in pic32_wdt_drv_probe()
@ 2016-06-17 17:11 weiyj_lk
  2016-06-17 21:29 ` Guenter Roeck
  2016-07-17 20:10 ` Wim Van Sebroeck
  0 siblings, 2 replies; 3+ messages in thread
From: weiyj_lk @ 2016-06-17 17:11 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: Wei Yongjun, linux-watchdog

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

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

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/watchdog/pic32-wdt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/pic32-wdt.c b/drivers/watchdog/pic32-wdt.c
index 6047aa8..2b7a2b2 100644
--- a/drivers/watchdog/pic32-wdt.c
+++ b/drivers/watchdog/pic32-wdt.c
@@ -174,8 +174,8 @@ static int pic32_wdt_drv_probe(struct platform_device *pdev)
 	struct resource *mem;
 
 	wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
-	if (IS_ERR(wdt))
-		return PTR_ERR(wdt);
+	if (!wdt)
+		return -ENOMEM;
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	wdt->regs = devm_ioremap_resource(&pdev->dev, mem);

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

* Re: [PATCH] watchdog: pic32-wdt: Fix return value check in pic32_wdt_drv_probe()
  2016-06-17 17:11 [PATCH] watchdog: pic32-wdt: Fix return value check in pic32_wdt_drv_probe() weiyj_lk
@ 2016-06-17 21:29 ` Guenter Roeck
  2016-07-17 20:10 ` Wim Van Sebroeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2016-06-17 21:29 UTC (permalink / raw)
  To: weiyj_lk; +Cc: Wim Van Sebroeck, Wei Yongjun, linux-watchdog

On Fri, Jun 17, 2016 at 05:11:35PM +0000, weiyj_lk@163.com wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> In case of error, the function devm_kzalloc() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should
> be replaced with NULL test.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Good catch.

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

> ---
>  drivers/watchdog/pic32-wdt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/pic32-wdt.c b/drivers/watchdog/pic32-wdt.c
> index 6047aa8..2b7a2b2 100644
> --- a/drivers/watchdog/pic32-wdt.c
> +++ b/drivers/watchdog/pic32-wdt.c
> @@ -174,8 +174,8 @@ static int pic32_wdt_drv_probe(struct platform_device *pdev)
>  	struct resource *mem;
>  
>  	wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
> -	if (IS_ERR(wdt))
> -		return PTR_ERR(wdt);
> +	if (!wdt)
> +		return -ENOMEM;
>  
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	wdt->regs = devm_ioremap_resource(&pdev->dev, mem);
> 
> 
> 

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

* Re: [PATCH] watchdog: pic32-wdt: Fix return value check in pic32_wdt_drv_probe()
  2016-06-17 17:11 [PATCH] watchdog: pic32-wdt: Fix return value check in pic32_wdt_drv_probe() weiyj_lk
  2016-06-17 21:29 ` Guenter Roeck
@ 2016-07-17 20:10 ` Wim Van Sebroeck
  1 sibling, 0 replies; 3+ messages in thread
From: Wim Van Sebroeck @ 2016-07-17 20:10 UTC (permalink / raw)
  To: weiyj_lk; +Cc: Guenter Roeck, Wei Yongjun, linux-watchdog

Hi Wei,

> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> In case of error, the function devm_kzalloc() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should
> be replaced with NULL test.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  drivers/watchdog/pic32-wdt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/pic32-wdt.c b/drivers/watchdog/pic32-wdt.c
> index 6047aa8..2b7a2b2 100644
> --- a/drivers/watchdog/pic32-wdt.c
> +++ b/drivers/watchdog/pic32-wdt.c
> @@ -174,8 +174,8 @@ static int pic32_wdt_drv_probe(struct platform_device *pdev)
>  	struct resource *mem;
>  
>  	wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
> -	if (IS_ERR(wdt))
> -		return PTR_ERR(wdt);
> +	if (!wdt)
> +		return -ENOMEM;
>  
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	wdt->regs = devm_ioremap_resource(&pdev->dev, mem);
> 
> 
> 

This patch has been added to linux-watchdog-next.

Kind regards,
Wim.


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

end of thread, other threads:[~2016-07-17 20:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-17 17:11 [PATCH] watchdog: pic32-wdt: Fix return value check in pic32_wdt_drv_probe() weiyj_lk
2016-06-17 21:29 ` Guenter Roeck
2016-07-17 20:10 ` Wim Van Sebroeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.