diff mbox series

[3/7] net: lan966x: Convert to devm_of_phy_optional_get()

Message ID a8673e0ed97d41721bb9718d3338fa6957a7f0f7.1674036164.git.geert+renesas@glider.be (mailing list archive)
State New, archived
Headers show
Series phy: Add devm_of_phy_optional_get() helper | expand

Commit Message

Geert Uytterhoeven Jan. 18, 2023, 10:15 a.m. UTC
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>
---
 drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Steen Hegelund Jan. 20, 2023, 8:46 a.m. UTC | #1
Hi Geert,

This looks good to me.

BR
Steen

Reviewed-by: Steen Hegelund <Steen.Hegelund@microchip.com>

On Wed, 2023-01-18 at 11:15 +0100, Geert Uytterhoeven wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the
> content is safe
> 
> 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>
> ---
>  drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> index cadde20505ba0689..d64a525cdc9ea18b 100644
> --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> @@ -1147,9 +1147,8 @@ static int lan966x_probe(struct platform_device *pdev)
>                 lan966x->ports[p]->config.portmode = phy_mode;
>                 lan966x->ports[p]->fwnode = fwnode_handle_get(portnp);
> 
> -               serdes = devm_of_phy_get(lan966x->dev, to_of_node(portnp),
> NULL);
> -               if (PTR_ERR(serdes) == -ENODEV)
> -                       serdes = NULL;
> +               serdes = devm_of_phy_optional_get(lan966x->dev,
> +                                                 to_of_node(portnp), NULL);
>                 if (IS_ERR(serdes)) {
>                         err = PTR_ERR(serdes);
>                         goto cleanup_ports;
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
index cadde20505ba0689..d64a525cdc9ea18b 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
@@ -1147,9 +1147,8 @@  static int lan966x_probe(struct platform_device *pdev)
 		lan966x->ports[p]->config.portmode = phy_mode;
 		lan966x->ports[p]->fwnode = fwnode_handle_get(portnp);
 
-		serdes = devm_of_phy_get(lan966x->dev, to_of_node(portnp), NULL);
-		if (PTR_ERR(serdes) == -ENODEV)
-			serdes = NULL;
+		serdes = devm_of_phy_optional_get(lan966x->dev,
+						  to_of_node(portnp), NULL);
 		if (IS_ERR(serdes)) {
 			err = PTR_ERR(serdes);
 			goto cleanup_ports;