[PATCH net-next] net: lan966x: free the RX pages when the TX allocation fails
From: Daniel Machon
Date: Tue Nov 17 2026 - 07:50:14 EST
lan966x_fdma_init() allocates the RX ring and fills its DCBs with pages
from the RX page pool, then allocates the TX ring. If the TX allocation
fails, the error path frees the RX ring and destroys the page pool, but
does not return the pages to the pool first.
The pool then never finishes its shutdown, and page_pool_release_retry()
keeps warning about the pages still in flight.
To let the pool shut down, return the RX pages before destroying it, as
lan966x_fdma_deinit() does. lan966x_fdma_rx_alloc() does not check that
every DCB got its pages, so skip the entries that are still empty.
Signed-off-by: Daniel Machon <daniel.machon@xxxxxxxxxxxxx>
---
drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
index 1fbe910c5ec38..586ee648c7741 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
@@ -54,9 +54,11 @@ static void lan966x_fdma_rx_free_pages(struct lan966x_rx *rx)
int i, j;
for (i = 0; i < fdma->n_dcbs; ++i) {
- for (j = 0; j < fdma->n_dbs; ++j)
- page_pool_put_full_page(rx->page_pool,
- rx->page[i][j], false);
+ for (j = 0; j < fdma->n_dbs; ++j) {
+ if (rx->page[i][j])
+ page_pool_put_full_page(rx->page_pool,
+ rx->page[i][j], false);
+ }
}
}
@@ -999,6 +1001,7 @@ int lan966x_fdma_init(struct lan966x *lan966x)
err = lan966x_fdma_tx_alloc(&lan966x->tx);
if (err) {
+ lan966x_fdma_rx_free_pages(&lan966x->rx);
fdma_free_coherent(lan966x->dma_dev, &lan966x->rx.fdma);
page_pool_destroy(lan966x->rx.page_pool);
return err;
---
base-commit: 994089a3fa3882f27f4bed9fc5815ee7df502e88
change-id: 20261116-lan966x-rx-pages-tx-alloc-fail-2b8e412f15f2
Best regards,
--
Daniel Machon <daniel.machon@xxxxxxxxxxxxx>