* [v4,5/5] dmaengine: mediatek: fix zalloc-simple.cocci warnings
@ 2018-02-08 17:58 sean.wang
0 siblings, 0 replies; 5+ messages in thread
From: sean.wang @ 2018-02-08 17:58 UTC (permalink / raw)
To: vinod.koul, dan.j.williams, robh+dt, mark.rutland
Cc: dmaengine, devicetree, linux-mediatek, linux-arm-kernel,
linux-kernel, Fengguang Wu, Sean Wang, Julia Lawall
From: Fengguang Wu <fengguang.wu@intel.com>
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 <sean.wang@mediatek.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
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);
ring->rxd = &ring->txd[MTK_DMA_SIZE];
ring->rphys = ring->tphys + MTK_DMA_SIZE * sizeof(*ring->txd);
ring->cur_tptr = 0;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [v4,5/5] dmaengine: mediatek: fix zalloc-simple.cocci warnings
@ 2018-02-09 12:58 Vinod Koul
0 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2018-02-09 12:58 UTC (permalink / raw)
To: sean.wang
Cc: dan.j.williams, robh+dt, mark.rutland, dmaengine, devicetree,
linux-mediatek, linux-arm-kernel, linux-kernel, Fengguang Wu,
Julia Lawall
On Fri, Feb 09, 2018 at 01:58:51AM +0800, sean.wang@mediatek.com wrote:
> From: Fengguang Wu <fengguang.wu@intel.com>
>
> 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 <sean.wang@mediatek.com>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
> 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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [v4,5/5] dmaengine: mediatek: fix zalloc-simple.cocci warnings
@ 2018-02-09 14:55 Julia Lawall
0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2018-02-09 14:55 UTC (permalink / raw)
To: Vinod Koul
Cc: sean.wang, dan.j.williams, robh+dt, mark.rutland, dmaengine,
devicetree, linux-mediatek, linux-arm-kernel, linux-kernel,
Fengguang Wu
On Fri, 9 Feb 2018, Vinod Koul wrote:
> On Fri, Feb 09, 2018 at 01:58:51AM +0800, sean.wang@mediatek.com wrote:
> > From: Fengguang Wu <fengguang.wu@intel.com>
> >
> > 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 <sean.wang@mediatek.com>
> > Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> > Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
> > Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> > ---
> > 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..
Sorry, I'm not sure what you mean by "folded back".
julia
>
> > 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 dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* [v4,5/5] dmaengine: mediatek: fix zalloc-simple.cocci warnings
@ 2018-02-13 6:46 Vinod Koul
0 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2018-02-13 6:46 UTC (permalink / raw)
To: Julia Lawall
Cc: sean.wang, dan.j.williams, robh+dt, mark.rutland, dmaengine,
devicetree, linux-mediatek, linux-arm-kernel, linux-kernel,
Fengguang Wu
On Fri, Feb 09, 2018 at 03:55:58PM +0100, Julia Lawall wrote:
>
> > > - 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..
>
> Sorry, I'm not sure what you mean by "folded back".
Since the original patch is also up for review in this series, it doesn't
help much to add a change and fix on top in a series. The fix should be
folded back into the original commit. IIRC Fengguang's bot also recommends
so..
^ permalink raw reply [flat|nested] 5+ messages in thread
* [v4,5/5] dmaengine: mediatek: fix zalloc-simple.cocci warnings
@ 2018-02-13 7:07 Julia Lawall
0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2018-02-13 7:07 UTC (permalink / raw)
To: Vinod Koul
Cc: sean.wang, dan.j.williams, robh+dt, mark.rutland, dmaengine,
devicetree, linux-mediatek, linux-arm-kernel, linux-kernel,
Fengguang Wu
On Tue, 13 Feb 2018, Vinod Koul wrote:
> On Fri, Feb 09, 2018 at 03:55:58PM +0100, Julia Lawall wrote:
> >
> > > > - 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..
> >
> > Sorry, I'm not sure what you mean by "folded back".
>
> Since the original patch is also up for review in this series, it doesn't
> help much to add a change and fix on top in a series. The fix should be
> folded back into the original commit. IIRC Fengguang's bot also recommends
> so..
Sure, no problem. Thanks. (I thought you meant folding or unfolding of a
function definition).
julia
---
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-02-13 7:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-09 12:58 [v4,5/5] dmaengine: mediatek: fix zalloc-simple.cocci warnings Vinod Koul
-- strict thread matches above, loose matches on Subject: below --
2018-02-13 7:07 Julia Lawall
2018-02-13 6:46 Vinod Koul
2018-02-09 14:55 Julia Lawall
2018-02-08 17:58 sean.wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).