Re: [PATCH v2 09/27] infiniband: remove unneeded memset
From: Jason Gunthorpe
Date: Wed Jul 03 2019 - 13:32:12 EST
On Fri, Jun 28, 2019 at 10:47:19AM +0800, Fuqian Huang wrote:
> pci_alloc_consistent calls dma_alloc_coherent directly.
> In commit af7ddd8a627c
> ("Merge tag 'dma-mapping-4.21' of git://git.infradead.org/users/hch/dma-mapping"),
> dma_alloc_coherent/dmam_alloc_coherent has already zeroed the memory.
> So the memset after these 3 function calls is not needed.
>
> Signed-off-by: Fuqian Huang <huangfq.daxian@xxxxxxxxx>
> ---
> drivers/infiniband/hw/cxgb3/cxio_hal.c | 3 ---
> drivers/infiniband/hw/cxgb4/cq.c | 1 -
> drivers/infiniband/hw/cxgb4/qp.c | 1 -
> drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 1 -
> drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 ---
> drivers/infiniband/hw/mthca/mthca_allocator.c | 2 --
> drivers/infiniband/hw/nes/nes_verbs.c | 3 ---
> drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 3 ---
> drivers/infiniband/ulp/ipoib/ipoib_cm.c | 1 -
> 9 files changed, 18 deletions(-)
Thanks, applied to rdma for-next
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
> index aa9dcfc36cd3..c59e00a0881f 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
> +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
> @@ -1153,7 +1153,6 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn,
> ret = -ENOMEM;
> goto err_tx;
> }
> - memset(p->tx_ring, 0, ipoib_sendq_size * sizeof(*p->tx_ring));
>
> p->qp = ipoib_cm_create_tx_qp(p->dev, p);
> memalloc_noio_restore(noio_flag);
I dropped this hunk and used the seperate patch since this has nothing
to do with dma_alloc_coherent.
Jason