Message ID | 20230817074000.355564-2-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:39:58PM +0800, Ruan Jinjie wrote: > The get_phy_device() function returns error pointers and never > returns NULL. Update the checks accordingly. > > Fixes: 43b3cf6634a4 ("drivers: net: phy: xgene: Add MDIO driver") > Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
diff --git a/drivers/net/mdio/mdio-xgene.c b/drivers/net/mdio/mdio-xgene.c index 683e8f8319ab..4e097ce2a7fd 100644 --- a/drivers/net/mdio/mdio-xgene.c +++ b/drivers/net/mdio/mdio-xgene.c @@ -265,7 +265,7 @@ struct phy_device *xgene_enet_phy_register(struct mii_bus *bus, int phy_addr) struct phy_device *phy_dev; phy_dev = get_phy_device(bus, phy_addr, false); - if (!phy_dev || IS_ERR(phy_dev)) + if (IS_ERR(phy_dev)) return NULL; if (phy_device_register(phy_dev))
The get_phy_device() function returns error pointers and never returns NULL. Update the checks accordingly. Fixes: 43b3cf6634a4 ("drivers: net: phy: xgene: Add MDIO driver") Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> --- drivers/net/mdio/mdio-xgene.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)