net: lan966x: use library helper for freeing tx buffers
authorDaniel Machon <daniel.machon@microchip.com>
Thu, 5 Sep 2024 08:06:37 +0000 (10:06 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 10 Sep 2024 09:04:16 +0000 (11:04 +0200)
The library has the helper fdma_free_phys() for freeing physical FDMA
memory. Use it in the exit path.

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c

index 1beafadce87adf8df2a3dfa8d672114fc00710fa..6f7e3c27c1a7688632c205bdc141b961b8d54f46 100644 (file)
@@ -229,14 +229,9 @@ out:
 static void lan966x_fdma_tx_free(struct lan966x_tx *tx)
 {
        struct lan966x *lan966x = tx->lan966x;
-       struct fdma *fdma = &tx->fdma;
-       int size;
 
        kfree(tx->dcbs_buf);
-
-       size = sizeof(struct fdma_dcb) * fdma->n_dcbs;
-       size = ALIGN(size, PAGE_SIZE);
-       dma_free_coherent(lan966x->dev, size, fdma->dcbs, fdma->dma);
+       fdma_free_coherent(lan966x->dev, &tx->fdma);
 }
 
 static void lan966x_fdma_tx_activate(struct lan966x_tx *tx)