b60c81a3a2c146e9b21bda8d704a23172f302a70
[openwrt/staging/zorun.git] /
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
5
6 Use dma_zalloc_coherent for allocating zeroed
7 memory and remove unnecessary memset function.
8
9 Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
10
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>
14 ---
15 .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 20 ++++++++++----------
16 1 file changed, 10 insertions(+), 10 deletions(-)
17
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
21 u64 address;
22 u32 addr;
23
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,
31 + GFP_KERNEL);
32 if (!devinfo->shared.scratch)
33 goto fail;
34
35 - memset(devinfo->shared.scratch, 0, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
36 -
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);
43
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,
51 + GFP_KERNEL);
52 if (!devinfo->shared.ringupd)
53 goto fail;
54
55 - memset(devinfo->shared.ringupd, 0, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
56 -
57 addr = devinfo->shared.tcm_base_address +
58 BRCMF_SHARED_DMA_RINGUPD_ADDR_OFFSET;
59 address = (u64)devinfo->shared.ringupd_dmahandle;