* [PATCH] dmaengine: use kmem_cache_zalloc instead of kmem_cache_alloc/memset
@ 2012-08-27 4:40 Wei Yongjun
2012-09-18 3:25 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2012-08-27 4:40 UTC (permalink / raw)
To: vinod.koul, djbw; +Cc: yongjun_wei, linux-kernel
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Using kmem_cache_zalloc() instead of kmem_cache_alloc() and memset().
spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/dma/ioat/dma_v2.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
index 8689576..b9d6678 100644
--- a/drivers/dma/ioat/dma_v2.c
+++ b/drivers/dma/ioat/dma_v2.c
@@ -434,12 +434,11 @@ static struct ioat_ring_ent *ioat2_alloc_ring_ent(struct dma_chan *chan, gfp_t f
return NULL;
memset(hw, 0, sizeof(*hw));
- desc = kmem_cache_alloc(ioat2_cache, flags);
+ desc = kmem_cache_zalloc(ioat2_cache, flags);
if (!desc) {
pci_pool_free(dma->dma_pool, hw, phys);
return NULL;
}
- memset(desc, 0, sizeof(*desc));
dma_async_tx_descriptor_init(&desc->txd, chan);
desc->txd.tx_submit = ioat2_tx_submit_unlock;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] dmaengine: use kmem_cache_zalloc instead of kmem_cache_alloc/memset
2012-08-27 4:40 [PATCH] dmaengine: use kmem_cache_zalloc instead of kmem_cache_alloc/memset Wei Yongjun
@ 2012-09-18 3:25 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2012-09-18 3:25 UTC (permalink / raw)
To: Wei Yongjun; +Cc: djbw, yongjun_wei, linux-kernel
On Mon, 2012-08-27 at 12:40 +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Using kmem_cache_zalloc() instead of kmem_cache_alloc() and memset().
>
> spatch with a semantic match is used to found this problem.
> (http://coccinelle.lip6.fr/)
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
> drivers/dma/ioat/dma_v2.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
> index 8689576..b9d6678 100644
> --- a/drivers/dma/ioat/dma_v2.c
> +++ b/drivers/dma/ioat/dma_v2.c
> @@ -434,12 +434,11 @@ static struct ioat_ring_ent *ioat2_alloc_ring_ent(struct dma_chan *chan, gfp_t f
> return NULL;
> memset(hw, 0, sizeof(*hw));
>
> - desc = kmem_cache_alloc(ioat2_cache, flags);
> + desc = kmem_cache_zalloc(ioat2_cache, flags);
> if (!desc) {
> pci_pool_free(dma->dma_pool, hw, phys);
> return NULL;
> }
> - memset(desc, 0, sizeof(*desc));
>
> dma_async_tx_descriptor_init(&desc->txd, chan);
> desc->txd.tx_submit = ioat2_tx_submit_unlock;
Applied thanks
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-18 3:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-27 4:40 [PATCH] dmaengine: use kmem_cache_zalloc instead of kmem_cache_alloc/memset Wei Yongjun
2012-09-18 3:25 ` Vinod Koul
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.