]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: ll_temac: Fix an NULL vs IS_ERR() check in temac_open()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 3 May 2019 12:50:24 +0000 (15:50 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 5 May 2019 17:29:25 +0000 (10:29 -0700)
The phy_connect() function doesn't return NULL pointers.  It returns
error pointers on error, so I have updated the check.

Fixes: 8425c41d1ef7 ("net: ll_temac: Extend support to non-device-tree platforms")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/xilinx/ll_temac_main.c

index ca95c726269a9bd27ae65ab19bc6d07605687aa9..fff3baf824a9a7977a5cedb40b1821846503099d 100644 (file)
@@ -927,9 +927,9 @@ static int temac_open(struct net_device *ndev)
        } else if (strlen(lp->phy_name) > 0) {
                phydev = phy_connect(lp->ndev, lp->phy_name, temac_adjust_link,
                                     lp->phy_interface);
-               if (!phydev) {
+               if (IS_ERR(phydev)) {
                        dev_err(lp->dev, "phy_connect() failed\n");
-                       return -ENODEV;
+                       return PTR_ERR(phydev);
                }
                phy_start(phydev);
        }