Skip to content

Commit b7acada

Browse files
himanshujha199640Kalle Valo
authored andcommitted
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: Luis R. Rodriguez <[email protected]> Signed-off-by: Himanshu Jha <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 378f6a1 commit b7acada

File tree

1 file changed

+10
-10
lines changed
  • drivers/net/wireless/broadcom/brcm80211/brcmfmac

1 file changed

+10
-10
lines changed

drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,14 +1251,14 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)
12511251
u64 address;
12521252
u32 addr;
12531253

1254-
devinfo->shared.scratch = dma_alloc_coherent(&devinfo->pdev->dev,
1255-
BRCMF_DMA_D2H_SCRATCH_BUF_LEN,
1256-
&devinfo->shared.scratch_dmahandle, GFP_KERNEL);
1254+
devinfo->shared.scratch =
1255+
dma_zalloc_coherent(&devinfo->pdev->dev,
1256+
BRCMF_DMA_D2H_SCRATCH_BUF_LEN,
1257+
&devinfo->shared.scratch_dmahandle,
1258+
GFP_KERNEL);
12571259
if (!devinfo->shared.scratch)
12581260
goto fail;
12591261

1260-
memset(devinfo->shared.scratch, 0, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
1261-
12621262
addr = devinfo->shared.tcm_base_address +
12631263
BRCMF_SHARED_DMA_SCRATCH_ADDR_OFFSET;
12641264
address = (u64)devinfo->shared.scratch_dmahandle;
@@ -1268,14 +1268,14 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)
12681268
BRCMF_SHARED_DMA_SCRATCH_LEN_OFFSET;
12691269
brcmf_pcie_write_tcm32(devinfo, addr, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
12701270

1271-
devinfo->shared.ringupd = dma_alloc_coherent(&devinfo->pdev->dev,
1272-
BRCMF_DMA_D2H_RINGUPD_BUF_LEN,
1273-
&devinfo->shared.ringupd_dmahandle, GFP_KERNEL);
1271+
devinfo->shared.ringupd =
1272+
dma_zalloc_coherent(&devinfo->pdev->dev,
1273+
BRCMF_DMA_D2H_RINGUPD_BUF_LEN,
1274+
&devinfo->shared.ringupd_dmahandle,
1275+
GFP_KERNEL);
12741276
if (!devinfo->shared.ringupd)
12751277
goto fail;
12761278

1277-
memset(devinfo->shared.ringupd, 0, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
1278-
12791279
addr = devinfo->shared.tcm_base_address +
12801280
BRCMF_SHARED_DMA_RINGUPD_ADDR_OFFSET;
12811281
address = (u64)devinfo->shared.ringupd_dmahandle;

0 commit comments

Comments
 (0)