Skip to content

Commit a6ebcae

Browse files
geertuvinodkoul
authored andcommitted
net: fman: memac: Convert to devm_of_phy_optional_get()
Use the new devm_of_phy_optional_get() helper instead of open-coding the same operation. As devm_of_phy_optional_get() returns NULL if either the PHY cannot be found, or if support for the PHY framework is not enabled, it is no longer needed to check for -ENODEV or -ENOSYS. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Sean Anderson <sean.anderson@seco.com> Link: https://lore.kernel.org/r/f2d801cd73cca36a7162819289480d7fc91fcc7e.1674584626.git.geert+renesas@glider.be Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent d02aa18 commit a6ebcae

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

drivers/net/ethernet/freescale/fman/fman_memac.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,13 +1152,12 @@ int memac_initialization(struct mac_device *mac_dev,
11521152
else
11531153
memac->sgmii_pcs = pcs;
11541154

1155-
memac->serdes = devm_of_phy_get(mac_dev->dev, mac_node, "serdes");
1156-
err = PTR_ERR(memac->serdes);
1157-
if (err == -ENODEV || err == -ENOSYS) {
1155+
memac->serdes = devm_of_phy_optional_get(mac_dev->dev, mac_node,
1156+
"serdes");
1157+
if (!memac->serdes) {
11581158
dev_dbg(mac_dev->dev, "could not get (optional) serdes\n");
1159-
memac->serdes = NULL;
11601159
} else if (IS_ERR(memac->serdes)) {
1161-
dev_err_probe(mac_dev->dev, err, "could not get serdes\n");
1160+
err = PTR_ERR(memac->serdes);
11621161
goto _return_fm_mac_free;
11631162
}
11641163

0 commit comments

Comments
 (0)