Re: [PATCH] dma: pl330: ensure DMA descriptors are zero-initialised

From: Will Deacon
Date: Fri Nov 29 2013 - 09:42:47 EST


On Fri, Nov 29, 2013 at 12:57:50PM +0000, Shevchenko, Andriy wrote:
> On Fri, 2013-11-29 at 11:50 +0000, Will Deacon wrote:
> > diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> > index 98641eaca080..79e52a94f054 100644
> > --- a/drivers/dma/pl330.c
> > +++ b/drivers/dma/pl330.c
> > @@ -2492,14 +2492,8 @@ static dma_cookie_t pl330_tx_submit(struct dma_async_tx_descriptor *tx)
> >
> > static inline void _init_desc(struct dma_pl330_desc *desc)
> > {
> > - desc->pchan = NULL;
> > desc->req.x = &desc->px;
> > desc->req.token = desc;
> > - desc->rqcfg.swap = SWAP_NO;
> > - desc->rqcfg.privileged = 0;
> > - desc->rqcfg.insnaccess = 0;
> > - desc->rqcfg.scctl = SCCTRL0;
> > - desc->rqcfg.dcctl = DCCTRL0;
> > desc->req.cfg = &desc->rqcfg;
> > desc->req.xfer_cb = dma_pl330_rqcb;
> > desc->txd.tx_submit = pl330_tx_submit;
> > @@ -2517,7 +2511,7 @@ static int add_desc(struct dma_pl330_dmac *pdmac, gfp_t flg, int count)
> > if (!pdmac)
> > return 0;
> >
> > - desc = kmalloc(count * sizeof(*desc), flg);
> > + desc = kzalloc(count * sizeof(*desc), flg);
>
> Maybe kcalloc() ?

Yup, that could work. I'll include that in v2 pending any other comments.

Cheers,

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/