Message ID | 20230817074000.355564-4-ruanjinjie@huawei.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: Fix return value check for get_phy_device() | expand |
On Thu, Aug 17, 2023 at 03:40:00PM +0800, Ruan Jinjie wrote: > The get_phy_device() function returns error pointers and never > returns NULL. Update the checks accordingly. > > Fixes: 1d1afa2ebf82 ("net: hns: register phy device in each mac initial sequence") > Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c index 928d934cb21a..13b5ee548744 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c @@ -705,8 +705,8 @@ hns_mac_register_phydev(struct mii_bus *mdio, struct hns_mac_cb *mac_cb, return -ENODATA; phy = get_phy_device(mdio, addr, is_c45); - if (!phy || IS_ERR(phy)) - return -EIO; + if (IS_ERR(phy)) + return PTR_ERR(phy); phy->irq = mdio->irq[addr];
The get_phy_device() function returns error pointers and never returns NULL. Update the checks accordingly. Fixes: 1d1afa2ebf82 ("net: hns: register phy device in each mac initial sequence") Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> --- drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)