stmmac: fix return value check in stmmac_open_ext_timer()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Thu, 20 Sep 2012 21:06:10 +0000 (21:06 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 21 Sep 2012 17:47:24 +0000 (13:47 -0400)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c

index 2a0e1abde7e73eeea25c9c457999765b5315a01f..197fb8cde1d3cbe95b5609b5c0d67871eba1ae1f 100644 (file)
@@ -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) {