Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751522AbeABEmz (ORCPT + 1 other); Mon, 1 Jan 2018 23:42:55 -0500 Received: from mail-sn1nam01on0075.outbound.protection.outlook.com ([104.47.32.75]:34958 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751251AbeABEmx (ORCPT ); Mon, 1 Jan 2018 23:42:53 -0500 From: "Rangankar, Manish" To: Himanshu Jha , "jejb@linux.vnet.ibm.com" , "martin.petersen@oracle.com" , "aacraid@adaptec.com" CC: "Gurumurthy, Anil" , "Kalluru, Sudarsana" , Dept-Eng QLogic Storage Upstream , "satishkh@cisco.com" , "sebaddel@cisco.com" , "kartilak@cisco.com" , Dept-Eng QLogic Storage Upstream , Dept-Eng QLA2xxx Upstream , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 9/9] scsi: bnx2i: Use zeroing allocator rather than allocator/memset Thread-Topic: [PATCH 9/9] scsi: bnx2i: Use zeroing allocator rather than allocator/memset Thread-Index: AQHTgYMj9V08N0v74kWUtD532uoJjqNgYXQA Date: Tue, 2 Jan 2018 04:42:51 +0000 Message-ID: References: <1514647712-6332-1-git-send-email-himanshujha199640@gmail.com> <1514647712-6332-10-git-send-email-himanshujha199640@gmail.com> In-Reply-To: <1514647712-6332-10-git-send-email-himanshujha199640@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Manish.Rangankar@cavium.com; x-originating-ip: [114.143.185.87] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BLUPR0701MB2017;7:t1NJ7ZdPnUR7Zl13iogeZt+NtvMYgxo9JvZ6cKjDaFZsGrB+889OHZ9KHybt67w0ByqX7fg/DRzt2TmuYjnXcMnM2wBTv8W9CBep+EHbLvHWCys1PEdRwKFz8U3zj8mzfsuoYmaEEu2f34lAsPOiTrfa/qlsvH/md1y10ufE8bb/KOgICyBq1X4nOVgIcIAT7ju5jQdd6cxoa06fK6G2s1fX5cmd41WTtXwi8QD7VL+mzNauBkCjfulkPSMMs21S x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-ms-office365-filtering-correlation-id: a3fdefb1-71f4-4767-cceb-08d5519b47e7 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7153060);SRVR:BLUPR0701MB2017; x-ms-traffictypediagnostic: BLUPR0701MB2017: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3231023)(944501075)(3002001)(6041268)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:BLUPR0701MB2017;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:BLUPR0701MB2017; x-forefront-prvs: 0540846A1D x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(396003)(346002)(39850400004)(39380400002)(366004)(24454002)(199004)(189003)(3280700002)(2201001)(6246003)(2501003)(39060400002)(2900100001)(3846002)(54906003)(5660300001)(6486002)(77096006)(6116002)(316002)(4326008)(97736004)(2906002)(66066001)(76176011)(86362001)(575784001)(478600001)(25786009)(102836004)(99286004)(14454004)(72206003)(106356001)(81156014)(105586002)(6436002)(81166006)(6506007)(36756003)(53546011)(53936002)(305945005)(3660700001)(2950100002)(8676002)(229853002)(110136005)(8936002)(6512007)(68736007)(7736002);DIR:OUT;SFP:1101;SCL:1;SRVR:BLUPR0701MB2017;H:BN3PR07MB2483.namprd07.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; x-microsoft-antispam-message-info: KlBBc5xwjjhQRd1T0zDtIf2tSDYuNuVsRjFXN9NtOfnunyLOYuwfwetW2WDXATVqlou+8BBPnrgmAvazgCv8Ew== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <029635F90AF1A945B541A75BA5BE2903@namprd07.prod.outlook.com> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-Network-Message-Id: a3fdefb1-71f4-4767-cceb-08d5519b47e7 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jan 2018 04:42:51.0010 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB2017 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 30/12/17 8:58 PM, "Himanshu Jha" wrote: >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 >--- > 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; >-- >2.7.4 Acked-by: Manish Rangankar >