aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2022-09-22 02:10:23 +0000
committerJakub Kicinski <kuba@kernel.org>2022-09-26 12:44:40 -0700
commit9f1e337851bed60fef8fbea2726a8cd976120c26 (patch)
tree3925f591e83cba68a309bb3913de2913443df25a
parentMerge branch 'net-dsa-microchip-ksz9477-enable-interrupt-for-internal-phy-link-detection' (diff)
downloadlinux-dev-9f1e337851bed60fef8fbea2726a8cd976120c26.tar.xz
linux-dev-9f1e337851bed60fef8fbea2726a8cd976120c26.zip
net: ethernet: adi: Fix return value check in adin1110_probe_netdevs()
In case of error, the function get_phy_device() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: bc93e19d088b ("net: ethernet: adi: Add ADIN1110 support") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Link: https://lore.kernel.org/r/20220922021023.811581-1-weiyongjun@huaweicloud.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/ethernet/adi/adin1110.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/adi/adin1110.c b/drivers/net/ethernet/adi/adin1110.c
index 4f3c372292f3..2de0ba95fb2c 100644
--- a/drivers/net/ethernet/adi/adin1110.c
+++ b/drivers/net/ethernet/adi/adin1110.c
@@ -1582,9 +1582,9 @@ static int adin1110_probe_netdevs(struct adin1110_priv *priv)
netdev->features |= NETIF_F_NETNS_LOCAL;
port_priv->phydev = get_phy_device(priv->mii_bus, i + 1, false);
- if (!port_priv->phydev) {
+ if (IS_ERR(port_priv->phydev)) {
netdev_err(netdev, "Could not find PHY with device address: %d.\n", i);
- return -ENODEV;
+ return PTR_ERR(port_priv->phydev);
}
port_priv->phydev = phy_connect(netdev,