dmaengine: mmp_pdma: Use dma_pool_zalloc
authorJulia Lawall <Julia.Lawall@lip6.fr>
Fri, 29 Apr 2016 20:09:08 +0000 (22:09 +0200)
committerVinod Koul <vinod.koul@intel.com>
Tue, 3 May 2016 06:53:11 +0000 (12:23 +0530)
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>
@@
expression d,e;
statement S;
@@

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

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/mmp_pdma.c

index e39457f13d4dd4d923b022312f883dfc39f99ba7..56f1fd68b6205af0de5c6f55687305c42de0f1e9 100644 (file)
@@ -364,13 +364,12 @@ mmp_pdma_alloc_descriptor(struct mmp_pdma_chan *chan)
        struct mmp_pdma_desc_sw *desc;
        dma_addr_t pdesc;
 
-       desc = dma_pool_alloc(chan->desc_pool, GFP_ATOMIC, &pdesc);
+       desc = dma_pool_zalloc(chan->desc_pool, GFP_ATOMIC, &pdesc);
        if (!desc) {
                dev_err(chan->dev, "out of memory for link descriptor\n");
                return NULL;
        }
 
-       memset(desc, 0, sizeof(*desc));
        INIT_LIST_HEAD(&desc->tx_list);
        dma_async_tx_descriptor_init(&desc->async_tx, &chan->chan);
        /* each desc has submit */