From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vinod Koul Subject: Re: [PATCH v4 5/5] dmaengine: mediatek: fix zalloc-simple.cocci warnings Date: Fri, 9 Feb 2018 18:28:18 +0530 Message-ID: <20180209125817.GB3666@localhost> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org Cc: dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, mark.rutland-5wv7dgnIgG8@public.gmane.org, dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Fengguang Wu , Julia Lawall List-Id: devicetree@vger.kernel.org On Fri, Feb 09, 2018 at 01:58:51AM +0800, sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org wrote: > From: Fengguang Wu > > Use zeroing allocator rather than allocator followed by memset with 0 > > Generated by: scripts/coccinelle/api/alloc/zalloc-simple.cocci > > Fixes: c8e4b2e4ca21 ("dmaengine: mediatek: Add MediaTek High-Speed DMA controller for MT7622 and MT7623 SoC") > Cc: Sean Wang > Signed-off-by: Fengguang Wu > Signed-off-by: Julia Lawall > Signed-off-by: Sean Wang > --- > drivers/dma/mediatek/mtk-hsdma.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/dma/mediatek/mtk-hsdma.c b/drivers/dma/mediatek/mtk-hsdma.c > index 42b5b23..d3b90fe 100644 > --- a/drivers/dma/mediatek/mtk-hsdma.c > +++ b/drivers/dma/mediatek/mtk-hsdma.c > @@ -325,13 +325,11 @@ static int mtk_hsdma_alloc_pchan(struct mtk_hsdma_device *hsdma, > * and [MTK_DMA_SIZE ... 2 * MTK_DMA_SIZE - 1] is for RX ring. > */ > pc->sz_ring = 2 * MTK_DMA_SIZE * sizeof(*ring->txd); > - ring->txd = dma_alloc_coherent(hsdma2dev(hsdma), > - pc->sz_ring, &ring->tphys, > - GFP_ATOMIC | __GFP_ZERO); > + ring->txd = dma_zalloc_coherent(hsdma2dev(hsdma), pc->sz_ring, > + &ring->tphys, GFP_ATOMIC); > if (!ring->txd) > return -ENOMEM; > > - memset(ring->txd, 0, pc->sz_ring); This should be folded back.. > ring->rxd = &ring->txd[MTK_DMA_SIZE]; > ring->rphys = ring->tphys + MTK_DMA_SIZE * sizeof(*ring->txd); > ring->cur_tptr = 0; > -- > 2.7.4 > -- ~Vinod -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html