netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] stmmac: fix return value check in stmmac_open_ext_timer()
@ 2012-09-21  7:06 Wei Yongjun
  2012-09-21  8:21 ` Giuseppe CAVALLARO
  2012-09-21 17:47 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2012-09-21  7:06 UTC (permalink / raw)
  To: peppe.cavallaro; +Cc: yongjun_wei, netdev

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

In case of error, the function clk_get() returns ERR_PTR()
and never returns NULL pointer. The NULL test in the error
handling should be replaced with IS_ERR().

dpatch engine is used to auto generated this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c
index 2a0e1ab..197fb8c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c
@@ -109,7 +109,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm)
 {
 	timer_clock = clk_get(NULL, TMU_CHANNEL);
 
-	if (timer_clock == NULL)
+	if (IS_ERR(timer_clock))
 		return -1;
 
 	if (tmu2_register_user(stmmac_timer_handler, (void *)dev) < 0) {

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

* Re: [PATCH] stmmac: fix return value check in stmmac_open_ext_timer()
  2012-09-21  7:06 [PATCH] stmmac: fix return value check in stmmac_open_ext_timer() Wei Yongjun
@ 2012-09-21  8:21 ` Giuseppe CAVALLARO
  2012-09-21 17:47 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Giuseppe CAVALLARO @ 2012-09-21  8:21 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: yongjun_wei, netdev

On 9/21/2012 9:06 AM, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> In case of error, the function clk_get() returns ERR_PTR()
> and never returns NULL pointer. The NULL test in the error
> handling should be replaced with IS_ERR().
>
> dpatch engine is used to auto generated this patch.
> (https://github.com/weiyj/dpatch)

FYI I have recently sent some patches (still under reviewing) to 
completely remove this dead code from the driver.

http://marc.info/?l=linux-netdev&m=134734656020277&w=2

Peppe

> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>   drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c
> index 2a0e1ab..197fb8c 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c
> @@ -109,7 +109,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm)
>   {
>   	timer_clock = clk_get(NULL, TMU_CHANNEL);
>
> -	if (timer_clock == NULL)
> +	if (IS_ERR(timer_clock))
>   		return -1;
>
>   	if (tmu2_register_user(stmmac_timer_handler, (void *)dev) < 0) {
>
>
>

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

* Re: [PATCH] stmmac: fix return value check in stmmac_open_ext_timer()
  2012-09-21  7:06 [PATCH] stmmac: fix return value check in stmmac_open_ext_timer() Wei Yongjun
  2012-09-21  8:21 ` Giuseppe CAVALLARO
@ 2012-09-21 17:47 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2012-09-21 17:47 UTC (permalink / raw)
  To: weiyj.lk; +Cc: peppe.cavallaro, yongjun_wei, netdev

From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Fri, 21 Sep 2012 15:06:10 +0800

> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> In case of error, the function clk_get() returns ERR_PTR()
> and never returns NULL pointer. The NULL test in the error
> handling should be replaced with IS_ERR().
> 
> dpatch engine is used to auto generated this patch.
> (https://github.com/weiyj/dpatch)
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Applied.

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

end of thread, other threads:[~2012-09-21 17:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-21  7:06 [PATCH] stmmac: fix return value check in stmmac_open_ext_timer() Wei Yongjun
2012-09-21  8:21 ` Giuseppe CAVALLARO
2012-09-21 17:47 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).