From patchwork Sat Dec 30 15:28:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Jha X-Patchwork-Id: 10137779 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 A29B660233 for ; Sat, 30 Dec 2017 15:30:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 951BF28776 for ; Sat, 30 Dec 2017 15:30:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 889752877F; Sat, 30 Dec 2017 15:30:36 +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=ham 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 31C1B28776 for ; Sat, 30 Dec 2017 15:30:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751388AbdL3Paf (ORCPT ); Sat, 30 Dec 2017 10:30:35 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:41014 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751380AbdL3Pad (ORCPT ); Sat, 30 Dec 2017 10:30:33 -0500 Received: by mail-pf0-f196.google.com with SMTP id j28so23170886pfk.8; Sat, 30 Dec 2017 07:30:33 -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:in-reply-to:references; bh=/5s1Xu1+m4bFF2sz8XEYUPtJ8pPe0nX13/SNsDnOTm0=; b=Ll97ZvJRTdVvR9uaoPb7hOuiSRBqgNo77rsXR49+4CfFie+LFUyQW0uINTGXYEabCF j6nJwuG1byHGtQKFVWXWLa74+ODQdSwer6euuUJQUFxK0v2TQcDLDJgeqVDFBooAVy0t 9Er9IvycvKVp7j2O6ZU1zael45BYieXktAYIlYJJoUov9U1JtwnfdPSI25aoqbX4P+gG 0sA8Wx1hTXNPCLBzq9eQAW8fZUzbtDxmv02PH47uoJwmKRZVZLT27ADkOQAubEqtCet6 mb2y85fOv65CSJ8EWCqNYPht1tRwwJFPuELcS/tCSwJ97VwnL+ity3m4H6uloPqXaswX CrgA== 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:in-reply-to :references; bh=/5s1Xu1+m4bFF2sz8XEYUPtJ8pPe0nX13/SNsDnOTm0=; b=XSgRIsdXCPODrmgLT465HOurl/4Cu88owZfVnmOG+bO7QutSKlSrWkxRGGgPnzlgAA cZFXXaamLRrEvuoSSB2gjMZBgAT9ETZstRLWoF04kCYYD69xWIOSAXSTylNI6PPe5MOy N38OajdGfm0FoUm7AT2fmNqyC8+Elh4SS0UQOrwnaanI2VfqcjsntFOC+welb1Jmms4r A3OE41DS7CCVvqHmkxAx0lbK1hCpNiS/cM6Yfdq9xREQrR3YuGUdXbRJdyzkX8c4OnmP 9Ol9HH/HcdvjoqrOdvsbhCb33ft47Aubi/Sez4oF7ixgs1JASqH39QO8aBdWBCpCJiTf qDvw== X-Gm-Message-State: AKGB3mKzSeZ1m9PAgpYD2Zon6KgKaBjeGKxmMYSrhXj9e+06Of+WyrGm gMQbpXMa8E+R69/FRXXxUjM= X-Google-Smtp-Source: ACJfBosBLnLxNRd6rK/QOaxkLZT+vAriQA/bdLP9838sj4ppyBqPKruny2VOpoDj/6kFkygAtGSREQ== X-Received: by 10.101.74.200 with SMTP id c8mr7938750pgu.234.1514647832671; Sat, 30 Dec 2017 07:30:32 -0800 (PST) Received: from localhost.localdomain ([103.46.193.14]) by smtp.gmail.com with ESMTPSA id f79sm81933715pfd.45.2017.12.30.07.30.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Dec 2017 07:30:31 -0800 (PST) From: Himanshu Jha To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, aacraid@adaptec.com Cc: anil.gurumurthy@qlogic.com, sudarsana.kalluru@qlogic.com, QLogic-Storage-Upstream@qlogic.com, satishkh@cisco.com, sebaddel@cisco.com, kartilak@cisco.com, QLogic-Storage-Upstream@cavium.com, qla2xxx-upstream@qlogic.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Himanshu Jha Subject: [PATCH 9/9] scsi: bnx2i: Use zeroing allocator rather than allocator/memset Date: Sat, 30 Dec 2017 20:58:32 +0530 Message-Id: <1514647712-6332-10-git-send-email-himanshujha199640@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514647712-6332-1-git-send-email-himanshujha199640@gmail.com> References: <1514647712-6332-1-git-send-email-himanshujha199640@gmail.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use dma_zalloc_coherent instead of dma_alloc_coherent followed by memset 0. Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci Suggested-by: Luis R. Rodriguez Signed-off-by: Himanshu Jha Acked-by: Manish Rangankar --- drivers/scsi/bnx2i/bnx2i_hwi.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index 9e3bf53..c6a0bd6 100644 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c @@ -1069,16 +1069,15 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep) } /* Allocate memory area for actual SQ element */ - ep->qp.sq_virt = - dma_alloc_coherent(&hba->pcidev->dev, ep->qp.sq_mem_size, - &ep->qp.sq_phys, GFP_KERNEL); + ep->qp.sq_virt = + dma_zalloc_coherent(&hba->pcidev->dev, ep->qp.sq_mem_size, + &ep->qp.sq_phys, GFP_KERNEL); if (!ep->qp.sq_virt) { printk(KERN_ALERT "bnx2i: unable to alloc SQ BD memory %d\n", ep->qp.sq_mem_size); goto mem_alloc_err; } - memset(ep->qp.sq_virt, 0x00, ep->qp.sq_mem_size); ep->qp.sq_first_qe = ep->qp.sq_virt; ep->qp.sq_prod_qe = ep->qp.sq_first_qe; ep->qp.sq_cons_qe = ep->qp.sq_first_qe; @@ -1106,15 +1105,14 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep) } /* Allocate memory area for actual CQ element */ - ep->qp.cq_virt = - dma_alloc_coherent(&hba->pcidev->dev, ep->qp.cq_mem_size, - &ep->qp.cq_phys, GFP_KERNEL); + ep->qp.cq_virt = + dma_zalloc_coherent(&hba->pcidev->dev, ep->qp.cq_mem_size, + &ep->qp.cq_phys, GFP_KERNEL); if (!ep->qp.cq_virt) { printk(KERN_ALERT "bnx2i: unable to alloc CQ BD memory %d\n", ep->qp.cq_mem_size); goto mem_alloc_err; } - memset(ep->qp.cq_virt, 0x00, ep->qp.cq_mem_size); ep->qp.cq_first_qe = ep->qp.cq_virt; ep->qp.cq_prod_qe = ep->qp.cq_first_qe;