1 From b7acadaf038740c43515dc1548f43d01cc92823a Mon Sep 17 00:00:00 2001
2 From: Himanshu Jha <himanshujha199640@gmail.com>
3 Date: Tue, 9 Jan 2018 02:15:31 +0530
4 Subject: [PATCH] brcmfmac: Use zeroing memory allocator than allocator/memset
6 Use dma_zalloc_coherent for allocating zeroed
7 memory and remove unnecessary memset function.
9 Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
11 Suggested-by: Luis R. Rodriguez <mcgrof@kernel.org>
12 Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
13 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
15 .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 20 ++++++++++----------
16 1 file changed, 10 insertions(+), 10 deletions(-)
18 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
19 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
20 @@ -1251,14 +1251,14 @@ static int brcmf_pcie_init_scratchbuffer
24 - devinfo->shared.scratch = dma_alloc_coherent(&devinfo->pdev->dev,
25 - BRCMF_DMA_D2H_SCRATCH_BUF_LEN,
26 - &devinfo->shared.scratch_dmahandle, GFP_KERNEL);
27 + devinfo->shared.scratch =
28 + dma_zalloc_coherent(&devinfo->pdev->dev,
29 + BRCMF_DMA_D2H_SCRATCH_BUF_LEN,
30 + &devinfo->shared.scratch_dmahandle,
32 if (!devinfo->shared.scratch)
35 - memset(devinfo->shared.scratch, 0, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
37 addr = devinfo->shared.tcm_base_address +
38 BRCMF_SHARED_DMA_SCRATCH_ADDR_OFFSET;
39 address = (u64)devinfo->shared.scratch_dmahandle;
40 @@ -1268,14 +1268,14 @@ static int brcmf_pcie_init_scratchbuffer
41 BRCMF_SHARED_DMA_SCRATCH_LEN_OFFSET;
42 brcmf_pcie_write_tcm32(devinfo, addr, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
44 - devinfo->shared.ringupd = dma_alloc_coherent(&devinfo->pdev->dev,
45 - BRCMF_DMA_D2H_RINGUPD_BUF_LEN,
46 - &devinfo->shared.ringupd_dmahandle, GFP_KERNEL);
47 + devinfo->shared.ringupd =
48 + dma_zalloc_coherent(&devinfo->pdev->dev,
49 + BRCMF_DMA_D2H_RINGUPD_BUF_LEN,
50 + &devinfo->shared.ringupd_dmahandle,
52 if (!devinfo->shared.ringupd)
55 - memset(devinfo->shared.ringupd, 0, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
57 addr = devinfo->shared.tcm_base_address +
58 BRCMF_SHARED_DMA_RINGUPD_ADDR_OFFSET;
59 address = (u64)devinfo->shared.ringupd_dmahandle;