[PATCH 4/7] net: ethernet: ti: am65-cpsw: Convert to devm_of_phy_optional_get()
Geert Uytterhoeven
geert+renesas at glider.be
Wed Jan 18 02:15:17 PST 2023
Use the new devm_of_phy_optional_get() helper instead of open-coding the
same operation.
While at it, fix handling of other error codes (e.g. -EPROBE_DEFER).
Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
drivers/net/ethernet/ti/am65-cpsw-nuss.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
index 5cac982841845369..794f228c8d632f7a 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
@@ -1460,9 +1460,9 @@ static int am65_cpsw_init_serdes_phy(struct device *dev, struct device_node *por
struct phy *phy;
int ret;
- phy = devm_of_phy_get(dev, port_np, name);
- if (PTR_ERR(phy) == -ENODEV)
- return 0;
+ phy = devm_of_phy_optional_get(dev, port_np, name);
+ if (IS_ERR_OR_NULL(phy))
+ return PTR_ERR_OR_ZERO(phy);
/* Serdes PHY exists. Store it. */
port->slave.serdes_phy = phy;
--
2.34.1
More information about the linux-phy
mailing list