[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230817074000.355564-4-ruanjinjie@huawei.com>
Date: Thu, 17 Aug 2023 15:40:00 +0800
From: Ruan Jinjie <ruanjinjie@...wei.com>
To: <Shyam-sundar.S-k@....com>, <davem@...emloft.net>, <edumazet@...gle.com>,
<kuba@...nel.org>, <pabeni@...hat.com>, <yisen.zhuang@...wei.com>,
<salil.mehta@...wei.com>, <iyappan@...amperecomputing.com>,
<keyur@...amperecomputing.com>, <quan@...amperecomputing.com>,
<andrew@...n.ch>, <hkallweit1@...il.com>, <linux@...linux.org.uk>,
<yankejian@...wei.com>, <netdev@...r.kernel.org>
CC: <ruanjinjie@...wei.com>
Subject: [PATCH net-next 3/3] net: hisilicon: hns: Fix return value check for get_phy_device()
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@...wei.com>
---
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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];
--
2.34.1
Powered by blists - more mailing lists