[PATCH 0/5] Use dma_pool_zalloc

Julia Lawall Julia.Lawall at lip6.fr
Sat Apr 30 06:09:07 AEST 2016


Dma_pool_zalloc combines dma_pool_alloc and memset 0.  The semantic patch
that makes this transformation is as follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
T *d;
expression e;
statement S;
@@

        d =
-            dma_pool_alloc
+            dma_pool_zalloc
             (...);
        if (!d) S
-       memset(d, 0, sizeof(T));

@@
expression d,e;
statement S;
@@

        d =
-            dma_pool_alloc
+            dma_pool_zalloc
             (...);
        if (!d) S
-       memset(d, 0, sizeof(*d));
// </smpl>

---

 drivers/crypto/marvell/tdma.c    |    5 ++---
 drivers/dma/fsldma.c             |    3 +--
 drivers/dma/ioat/init.c          |    5 ++---
 drivers/dma/mmp_pdma.c           |    3 +--
 drivers/dma/xilinx/xilinx_vdma.c |    3 +--
 5 files changed, 7 insertions(+), 12 deletions(-)


More information about the Linuxppc-dev mailing list