# Re: \[net-next\] net: txgbe: fix phylink leak on AML init failure

- From: Maxime Chevallier \<maxime.chevallier@bootlin.com\>
- Date: 2026-05-22 07:27:10 
- List: netdev
- Page: https://ratatoskr.run/netdev/2026/05/17018263
- Thread: https://ratatoskr.run/netdev/2026/05/17018073/t.md

```text
Hi,

On 5/22/26 09:07, Chenguang Zhao wrote:
> Destroy the phylink instance when fixed-link setup fails.

This should probably be a fix then, targeting the 'net' tree with a Fixes tag.

>
> Signed-off-by: Chenguang Zhao <redacted>

With the above comment sorted out,

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Maxime

> ---
>   drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c
> index f0514251d4f3..8e301e7d1148 100644
> --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c
> +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c
> @@ -521,6 +521,7 @@ int txgbe_phylink_init_aml(struct txgbe *txgbe)
>   	err = phylink_set_fixed_link(phylink, &state);
>   	if (err) {
>   		wx_err(wx, "Failed to set fixed link\n");
> +		phylink_destroy(phylink);
>   		return err;
>   	}
>   

```
