Skip to content

Commit

Permalink
net: ethernet: ti: am65-cpsw: Convert to devm_of_phy_optional_get()
Browse files Browse the repository at this point in the history
Use the new devm_of_phy_optional_get() helper instead of open-coding the
same operation.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/01605ea233ff7fc09bb0ea34fc8126af73db83f9.1678280599.git.geert+renesas@glider.be
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Geert Uytterhoeven authored and Jakub Kicinski committed Mar 10, 2023
1 parent 76b9bf9 commit b3a8df9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/net/ethernet/ti/am65-cpsw-nuss.c
Original file line number Diff line number Diff line change
Expand Up @@ -1470,11 +1470,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;
if (IS_ERR(phy))
return PTR_ERR(phy);
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;
Expand Down

0 comments on commit b3a8df9

Please sign in to comment.