From patchwork Sat Dec 30 15:51:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Jha X-Patchwork-Id: 10137819 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 603876037D for ; Sat, 30 Dec 2017 15:52:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5191A287B3 for ; Sat, 30 Dec 2017 15:52:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44278287B9; Sat, 30 Dec 2017 15:52:32 +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=-3.7 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SBL_CSS 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 02F45287B3 for ; Sat, 30 Dec 2017 15:52:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751063AbdL3PwS (ORCPT ); Sat, 30 Dec 2017 10:52:18 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:36291 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750931AbdL3PwQ (ORCPT ); Sat, 30 Dec 2017 10:52:16 -0500 Received: by mail-pl0-f68.google.com with SMTP id b12so24610954plm.3; Sat, 30 Dec 2017 07:52:16 -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=QOPuGNaDiIfyPW03ACcz7zQJbieDpXkVZZP5P4khw7E=; b=DA9V33ZNayjIu3echv60C0mJjDYVl7GJp4DDfu1FjECqbQ/tRrdRhmpoDc4YL1DpZX 4yxGCAb9a2bin7wClNTUsPVl/OCtFFqgamTdiKnZmMqb/TABvLQ7a2A1rGNukxQOwqXL cuznwLk5WKSpa32c99cwSvOHpqCSgasriyjZnPaGoWCC395zNnGlijTo6U/AaAsRqpE2 7Bi2bjgbC2y2NSM+iyxqvga10+8ePS9aAk6AlbfDAoyIUrjLybEofSV2LokMdg5JkMjP uCoCEQwgeO7stmKMtirGMwQejtoQbpbq+T+/h2Kz6rY2HF/EH0riKrnfxyUoypegPcy6 ai6Q== 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=QOPuGNaDiIfyPW03ACcz7zQJbieDpXkVZZP5P4khw7E=; b=ExSt+OCAlOkn+XYGNEBCtur5axetXP62sAVrW6tXRS9PHEcCjkFQWw+ycDoy1EGWUO ynZLa3k4Heo4fQPwuff0+uFTsaohUCFKneg/zG9ySiFiFySA8MliDp6kUQvSJa7UNje1 ySTfJc+t+AHAQMNUAJTcoym/RWQsifBitQANRfMj7q0rI/+8gcX4X+73TTeK8WnfV9HO SM5uxtR8wINIff/3piwAN4hLjW9H2IkQnnolk6yxX6zVAsOE0+IKxYe1MstnrwfnHZjx YDxfrGvoXDKwqa5R6YdzLAGUMiP6/aG1twpnnaOuaOkddBiUABBzkKRJTl3N1XB5I6UW TBjg== X-Gm-Message-State: AKGB3mJFuR/ecGwSbvlwg44trqMUlLY+L1Oen88BO5PA9kYEqANjFpWK CSu9I48xTsmS4rWs5YROIoM= X-Google-Smtp-Source: ACJfBouAvAn6Ladl9sZL4mcJe8mL6ABpWNJiNzj2vpyfGB+rr74LE0OD2WWXnsqe5p9Le1Z5ZaWWmg== X-Received: by 10.84.232.194 with SMTP id x2mr39631041plm.111.1514649136274; Sat, 30 Dec 2017 07:52:16 -0800 (PST) Received: from localhost.localdomain ([103.46.193.14]) by smtp.gmail.com with ESMTPSA id u19sm49891287pgv.6.2017.12.30.07.52.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Dec 2017 07:52:14 -0800 (PST) From: Himanshu Jha To: arend.vanspriel@broadcom.com Cc: franky.lin@broadcom.com, hante.meuleman@broadcom.com, chi-hsien.lin@cypress.com, wright.feng@cypress.com, kvalo@codeaurora.org, 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, mcgrof@kernel.org, Himanshu Jha Subject: [PATCH] brcmfmac: Use zeroing memory allocator than allocator/memset Date: Sat, 30 Dec 2017 21:21:53 +0530 Message-Id: <1514649113-7366-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. Done using Coccinelle. Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci 0-day tested with no failures. Suggested-by: Luis R. Rodriguez Signed-off-by: Himanshu Jha Reviewed-by: Andy Shevchenko --- .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 18 ++++++++---------- 1 file changed, 8 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..bdef2ac 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c @@ -1251,14 +1251,13 @@ 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 +1267,13 @@ 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;