All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] watchdog: pic32-dmt: Fix return value check in pic32_dmt_probe()
@ 2016-06-17 17:12 weiyj_lk
  2016-06-17 21:30 ` Guenter Roeck
  2016-07-17 20:11 ` Wim Van Sebroeck
  0 siblings, 2 replies; 3+ messages in thread
From: weiyj_lk @ 2016-06-17 17:12 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-dmt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/pic32-dmt.c b/drivers/watchdog/pic32-dmt.c
index 962f58c..5e8890e 100644
--- a/drivers/watchdog/pic32-dmt.c
+++ b/drivers/watchdog/pic32-dmt.c
@@ -176,8 +176,8 @@ static int pic32_dmt_probe(struct platform_device *pdev)
 	struct watchdog_device *wdd = &pic32_dmt_wdd;
 
 	dmt = devm_kzalloc(&pdev->dev, sizeof(*dmt), GFP_KERNEL);
-	if (IS_ERR(dmt))
-		return PTR_ERR(dmt);
+	if (!dmt)
+		return -ENOMEM;
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	dmt->regs = devm_ioremap_resource(&pdev->dev, mem);

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

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

On Fri, Jun 17, 2016 at 05:12:05PM +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>

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

> ---
>  drivers/watchdog/pic32-dmt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/pic32-dmt.c b/drivers/watchdog/pic32-dmt.c
> index 962f58c..5e8890e 100644
> --- a/drivers/watchdog/pic32-dmt.c
> +++ b/drivers/watchdog/pic32-dmt.c
> @@ -176,8 +176,8 @@ static int pic32_dmt_probe(struct platform_device *pdev)
>  	struct watchdog_device *wdd = &pic32_dmt_wdd;
>  
>  	dmt = devm_kzalloc(&pdev->dev, sizeof(*dmt), GFP_KERNEL);
> -	if (IS_ERR(dmt))
> -		return PTR_ERR(dmt);
> +	if (!dmt)
> +		return -ENOMEM;
>  
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	dmt->regs = devm_ioremap_resource(&pdev->dev, mem);
> 
> 
> 

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

* Re: [PATCH] watchdog: pic32-dmt: Fix return value check in pic32_dmt_probe()
  2016-06-17 17:12 [PATCH] watchdog: pic32-dmt: Fix return value check in pic32_dmt_probe() weiyj_lk
  2016-06-17 21:30 ` Guenter Roeck
@ 2016-07-17 20:11 ` Wim Van Sebroeck
  1 sibling, 0 replies; 3+ messages in thread
From: Wim Van Sebroeck @ 2016-07-17 20:11 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-dmt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/pic32-dmt.c b/drivers/watchdog/pic32-dmt.c
> index 962f58c..5e8890e 100644
> --- a/drivers/watchdog/pic32-dmt.c
> +++ b/drivers/watchdog/pic32-dmt.c
> @@ -176,8 +176,8 @@ static int pic32_dmt_probe(struct platform_device *pdev)
>  	struct watchdog_device *wdd = &pic32_dmt_wdd;
>  
>  	dmt = devm_kzalloc(&pdev->dev, sizeof(*dmt), GFP_KERNEL);
> -	if (IS_ERR(dmt))
> -		return PTR_ERR(dmt);
> +	if (!dmt)
> +		return -ENOMEM;
>  
>  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	dmt->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:11 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:12 [PATCH] watchdog: pic32-dmt: Fix return value check in pic32_dmt_probe() weiyj_lk
2016-06-17 21:30 ` Guenter Roeck
2016-07-17 20:11 ` 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.