mediatek: checking for IS_ERR() instead of NULL
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 15 Mar 2016 07:18:49 +0000 (10:18 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Mar 2016 22:28:11 +0000 (18:28 -0400)
of_phy_connect() returns NULL on error, it never returns error pointers.

Fixes: 656e705243fd ('net-next: mediatek: add support for MT7623 ethernet')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: John Crispin <blogic@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mediatek/mtk_eth_soc.c

index 1e6c5498bba9fcafce0cc6acf8b9c157f64d5aa9..fd19d2d163b8e695bee4c670df6336e9ecdae195 100644 (file)
@@ -186,9 +186,9 @@ static int mtk_phy_connect_node(struct mtk_eth *eth, struct mtk_mac *mac,
 
        phydev = of_phy_connect(eth->netdev[mac->id], phy_node,
                                mtk_phy_link_adjust, 0, phy_mode);
-       if (IS_ERR(phydev)) {
+       if (!phydev) {
                dev_err(eth->dev, "could not connect to PHY\n");
-               return PTR_ERR(phydev);
+               return -ENODEV;
        }
 
        dev_info(eth->dev,