net: ethernet: ixp4xx: Make use of dma_pool_zalloc() instead of dma_pool_alloc/memset()
authorCai Huoqing <caihuoqing@baidu.com>
Mon, 18 Oct 2021 13:16:29 +0000 (21:16 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Oct 2021 12:24:26 +0000 (13:24 +0100)
Replacing dma_pool_alloc/memset() with dma_pool_zalloc()
to simplify the code.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/xscale/ixp4xx_eth.c

index 3e5fd952aeaa5d340469ac0951800db044ddcd1d..65fdad1107fc598a30df0d807dc27c7c0f733adb 100644 (file)
@@ -1103,10 +1103,9 @@ static int init_queues(struct port *port)
                        return -ENOMEM;
        }
 
-       if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL,
-                                             &port->desc_tab_phys)))
+       port->desc_tab = dma_pool_zalloc(dma_pool, GFP_KERNEL, &port->desc_tab_phys);
+       if (!port->desc_tab)
                return -ENOMEM;
-       memset(port->desc_tab, 0, POOL_ALLOC_SIZE);
        memset(port->rx_buff_tab, 0, sizeof(port->rx_buff_tab)); /* tables */
        memset(port->tx_buff_tab, 0, sizeof(port->tx_buff_tab));