From patchwork Mon Jan 8 20:45:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Jha X-Patchwork-Id: 10150583 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5CD4A601A1 for ; Mon, 8 Jan 2018 20:46:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6471A2844C for ; Mon, 8 Jan 2018 20:46:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58253286EB; Mon, 8 Jan 2018 20:46:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12DB72844C for ; Mon, 8 Jan 2018 20:46:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756515AbeAHUp5 (ORCPT ); Mon, 8 Jan 2018 15:45:57 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:44699 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756322AbeAHUpz (ORCPT ); Mon, 8 Jan 2018 15:45:55 -0500 Received: by mail-pf0-f195.google.com with SMTP id m26so6815784pfj.11; Mon, 08 Jan 2018 12:45:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=9uwH0IeosJauon6w4KH5ncq7XXJk5cg6LycK//0dtok=; b=rY0JlbvDk15sCWlidXsqizqfmgTpMQMxm+IrD5n6hcwf6aPo/L4WuVwfTFMCjIZ6sp 8drMZvqUpMZ9TIwU5vd8BpKo80HE38RrbKBLvJzsxC4bYcDqtm8s9qMVtmoY/QNSGNCr wAiFsdPFutwC1pnxESsX1seYBwyRR/Jg/vDSmYAGmjigzpC2TcfFTKDiWJGMnEW9M5CD MnfhvQ5kjXC+S45UWmw77YRcrbp7DB08moyuSy4UUr732HH1zf9gc4YeaJ3rUoV3FMSF z8NxM/tk/Zb3euc4HuXtz+VEHwB9xzDNGBv2s2HSOR0byLNM0hReyvtLlBhERb5rSuaE O7+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9uwH0IeosJauon6w4KH5ncq7XXJk5cg6LycK//0dtok=; b=rEexTOMbtUqQgO8ILE99gj8gV+2M9hUcp/FhlpGWdcnDV4/Noyt82Tk3PtqiY/v3ln qnyPTVyeaSN5EDxQfnPkZ2Kz/WBaT0RsiW11qvDtyyk/E8g06Wimc6IV20BglxPoa8T4 IepWcf9xF82GQNmRDjMQsc3D5yCL0nE9N9SKGZM7Csa+iN4I0IeAAtarbyDlF0dQS5K1 bWkrIdZIliotuQtlrq4NBWV9M2m90+wfyuN0Ktvb7Q0zdOgRUQ+K6ukx8NYRZwVxhrU4 x64F7rJxOSTcoE+loQ9XgiO5JtfROV1+xOmQDv3IM9kpiZUgqTMVcmJOOnergjufj5f2 Rq4Q== X-Gm-Message-State: AKGB3mIWbpNk1obDVmVm7aJTXSYwZUF/sIXTIdGPIeAtcsR+bLjjqex6 KdJiI3QMwsx1+k22R5U3bt0= X-Google-Smtp-Source: ACJfBosczT1L70q/1GiBzvMjeG7r+aMHLE16nkEhE/dqz9NBt1GcrSQfxLyp2A080yBe6Uud8xFA7A== X-Received: by 10.101.76.75 with SMTP id l11mr10404443pgr.187.1515444354912; Mon, 08 Jan 2018 12:45:54 -0800 (PST) Received: from localhost.localdomain ([103.46.193.14]) by smtp.gmail.com with ESMTPSA id x22sm27495785pfa.169.2018.01.08.12.45.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Jan 2018 12:45:53 -0800 (PST) From: Himanshu Jha To: kvalo@codeaurora.org Cc: arend.vanspriel@broadcom.com, franky.lin@broadcom.com, hante.meuleman@broadcom.com, chi-hsien.lin@cypress.com, wright.feng@cypress.com, linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, andy.shevchenko@gmail.com, Himanshu Jha Subject: [PATCH v2] brcmfmac: Use zeroing memory allocator than allocator/memset Date: Tue, 9 Jan 2018 02:15:31 +0530 Message-Id: <1515444331-19509-1-git-send-email-himanshujha199640@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Himanshu Jha --- v2: -corrected the patch to be applied into the branch without corruption .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c index 3c87157..8752707 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c @@ -1251,14 +1251,14 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo) u64 address; u32 addr; - devinfo->shared.scratch = dma_alloc_coherent(&devinfo->pdev->dev, - BRCMF_DMA_D2H_SCRATCH_BUF_LEN, - &devinfo->shared.scratch_dmahandle, GFP_KERNEL); + devinfo->shared.scratch = + dma_zalloc_coherent(&devinfo->pdev->dev, + BRCMF_DMA_D2H_SCRATCH_BUF_LEN, + &devinfo->shared.scratch_dmahandle, + GFP_KERNEL); if (!devinfo->shared.scratch) goto fail; - memset(devinfo->shared.scratch, 0, BRCMF_DMA_D2H_SCRATCH_BUF_LEN); - addr = devinfo->shared.tcm_base_address + BRCMF_SHARED_DMA_SCRATCH_ADDR_OFFSET; address = (u64)devinfo->shared.scratch_dmahandle; @@ -1268,14 +1268,14 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo) BRCMF_SHARED_DMA_SCRATCH_LEN_OFFSET; brcmf_pcie_write_tcm32(devinfo, addr, BRCMF_DMA_D2H_SCRATCH_BUF_LEN); - devinfo->shared.ringupd = dma_alloc_coherent(&devinfo->pdev->dev, - BRCMF_DMA_D2H_RINGUPD_BUF_LEN, - &devinfo->shared.ringupd_dmahandle, GFP_KERNEL); + devinfo->shared.ringupd = + dma_zalloc_coherent(&devinfo->pdev->dev, + BRCMF_DMA_D2H_RINGUPD_BUF_LEN, + &devinfo->shared.ringupd_dmahandle, + GFP_KERNEL); if (!devinfo->shared.ringupd) goto fail; - memset(devinfo->shared.ringupd, 0, BRCMF_DMA_D2H_RINGUPD_BUF_LEN); - addr = devinfo->shared.tcm_base_address + BRCMF_SHARED_DMA_RINGUPD_ADDR_OFFSET; address = (u64)devinfo->shared.ringupd_dmahandle;