Commit b7acadaf authored by Himanshu Jha's avatar Himanshu Jha Committed by Kalle Valo

brcmfmac: Use zeroing memory allocator than allocator/memset

Use dma_zalloc_coherent for allocating zeroed
memory and remove unnecessary memset function.

Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
Suggested-by: default avatarLuis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: default avatarHimanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 378f6a16
...@@ -1251,14 +1251,14 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo) ...@@ -1251,14 +1251,14 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)
u64 address; u64 address;
u32 addr; u32 addr;
devinfo->shared.scratch = dma_alloc_coherent(&devinfo->pdev->dev, devinfo->shared.scratch =
dma_zalloc_coherent(&devinfo->pdev->dev,
BRCMF_DMA_D2H_SCRATCH_BUF_LEN, BRCMF_DMA_D2H_SCRATCH_BUF_LEN,
&devinfo->shared.scratch_dmahandle, GFP_KERNEL); &devinfo->shared.scratch_dmahandle,
GFP_KERNEL);
if (!devinfo->shared.scratch) if (!devinfo->shared.scratch)
goto fail; goto fail;
memset(devinfo->shared.scratch, 0, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
addr = devinfo->shared.tcm_base_address + addr = devinfo->shared.tcm_base_address +
BRCMF_SHARED_DMA_SCRATCH_ADDR_OFFSET; BRCMF_SHARED_DMA_SCRATCH_ADDR_OFFSET;
address = (u64)devinfo->shared.scratch_dmahandle; address = (u64)devinfo->shared.scratch_dmahandle;
...@@ -1268,14 +1268,14 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo) ...@@ -1268,14 +1268,14 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)
BRCMF_SHARED_DMA_SCRATCH_LEN_OFFSET; BRCMF_SHARED_DMA_SCRATCH_LEN_OFFSET;
brcmf_pcie_write_tcm32(devinfo, addr, BRCMF_DMA_D2H_SCRATCH_BUF_LEN); brcmf_pcie_write_tcm32(devinfo, addr, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
devinfo->shared.ringupd = dma_alloc_coherent(&devinfo->pdev->dev, devinfo->shared.ringupd =
dma_zalloc_coherent(&devinfo->pdev->dev,
BRCMF_DMA_D2H_RINGUPD_BUF_LEN, BRCMF_DMA_D2H_RINGUPD_BUF_LEN,
&devinfo->shared.ringupd_dmahandle, GFP_KERNEL); &devinfo->shared.ringupd_dmahandle,
GFP_KERNEL);
if (!devinfo->shared.ringupd) if (!devinfo->shared.ringupd)
goto fail; goto fail;
memset(devinfo->shared.ringupd, 0, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
addr = devinfo->shared.tcm_base_address + addr = devinfo->shared.tcm_base_address +
BRCMF_SHARED_DMA_RINGUPD_ADDR_OFFSET; BRCMF_SHARED_DMA_RINGUPD_ADDR_OFFSET;
address = (u64)devinfo->shared.ringupd_dmahandle; address = (u64)devinfo->shared.ringupd_dmahandle;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment