Skip to content

Commit

Permalink
ALSA: Use dma_zalloc_coherent
Browse files Browse the repository at this point in the history
Use the zeroing function instead of dma_alloc_coherent & memset(,0,)

Signed-off-by: Joe Perches <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
JoePerches authored and tiwai committed Jun 16, 2014
1 parent 74b0c2d commit 7f0f204
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
12 changes: 4 additions & 8 deletions sound/aoa/soundbus/i2sbus/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,11 @@ static int alloc_dbdma_descriptor_ring(struct i2sbus_dev *i2sdev,
/* We use the PCI APIs for now until the generic one gets fixed
* enough or until we get some macio-specific versions
*/
r->space = dma_alloc_coherent(
&macio_get_pci_dev(i2sdev->macio)->dev,
r->size,
&r->bus_addr,
GFP_KERNEL);
r->space = dma_zalloc_coherent(&macio_get_pci_dev(i2sdev->macio)->dev,
r->size, &r->bus_addr, GFP_KERNEL);
if (!r->space)
return -ENOMEM;

if (!r->space) return -ENOMEM;

memset(r->space, 0, r->size);
r->cmds = (void*)DBDMA_ALIGN(r->space);
r->bus_cmd_start = r->bus_addr +
(dma_addr_t)((char*)r->cmds - (char*)r->space);
Expand Down
6 changes: 2 additions & 4 deletions sound/sparc/dbri.c
Original file line number Diff line number Diff line change
Expand Up @@ -2534,12 +2534,10 @@ static int snd_dbri_create(struct snd_card *card,
dbri->op = op;
dbri->irq = irq;

dbri->dma = dma_alloc_coherent(&op->dev,
sizeof(struct dbri_dma),
&dbri->dma_dvma, GFP_ATOMIC);
dbri->dma = dma_zalloc_coherent(&op->dev, sizeof(struct dbri_dma),
&dbri->dma_dvma, GFP_ATOMIC);
if (!dbri->dma)
return -ENOMEM;
memset((void *)dbri->dma, 0, sizeof(struct dbri_dma));

dprintk(D_GEN, "DMA Cmd Block 0x%p (0x%08x)\n",
dbri->dma, dbri->dma_dvma);
Expand Down

0 comments on commit 7f0f204

Please sign in to comment.