Subject: Re: [PATCH net-next V2 4/5] net: lan743x: Implement phylink pcs

From: Maxime Chevallier <[email-masked]>
Date: Wed, 11 Sep 2024 19:24:25 +0200

Hello Raju,

On Wed, 11 Sep 2024 21:40:53 +0530
Raju Lakkaraju <[email-masked]> wrote:

[...]

> @@ -3820,9 +3869,28 @@ static int lan743x_mdiobus_init(struct lan743x_adapter *adapter)
>  	ret = mdiobus_register(adapter->mdiobus);
>  	if (ret < 0)
>  		goto return_error;
> +
> +	if (adapter->is_sfp_support_en) {
> +		if (!adapter->phy_interface)
> +			lan743x_phy_interface_select(adapter);
> +
> +		xpcs = xpcs_create_mdiodev(adapter->mdiobus, 0,
> +					   adapter->phy_interface);
> +		if (IS_ERR(xpcs)) {
> +			netdev_err(adapter->netdev, "failed to create xpcs\n");
> +			ret = PTR_ERR(xpcs);
> +			goto err_destroy_xpcs;
> +		}
> +		adapter->xpcs = xpcs;
> +	}
> +
>  	return 0;
>  
> +err_destroy_xpcs:
> +	xpcs_destroy(xpcs);

It looks like here, you're destroying the xpcs only when the xpcs
couln't be created in the first place, so no need to destroy it :)

Best regards,

Maxime