Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751063AbeABVOq (ORCPT + 1 other); Tue, 2 Jan 2018 16:14:46 -0500 Received: from mail-cys01nam02on0065.outbound.protection.outlook.com ([104.47.37.65]:43758 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750873AbeABVOn (ORCPT ); Tue, 2 Jan 2018 16:14:43 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Chad.Dupuis@cavium.com; Date: Tue, 2 Jan 2018 16:14:18 -0500 (EST) From: Chad Dupuis X-X-Sender: cdupuis@n5127mncfb42q1.qlogic.org To: Himanshu Jha cc: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, aacraid@adaptec.com, 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 Subject: Re: [PATCH 7/9] scsi: bnx2fc: Use zeroing allocator rather than allocator/memset In-Reply-To: <1514647712-6332-8-git-send-email-himanshujha199640@gmail.com> Message-ID: References: <1514647712-6332-1-git-send-email-himanshujha199640@gmail.com> <1514647712-6332-8-git-send-email-himanshujha199640@gmail.com> User-Agent: Alpine 2.00 (OSX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Originating-IP: [96.72.55.81] X-ClientProxiedBy: MWHPR08CA0006.namprd08.prod.outlook.com (10.174.103.147) To DM5PR07MB2780.namprd07.prod.outlook.com (10.168.104.148) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0829971a-3a6f-4baf-f565-08d55225d662 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060);SRVR:DM5PR07MB2780; X-Microsoft-Exchange-Diagnostics: 1;DM5PR07MB2780;3:TyHqhLQxo+97RqcQGlIfO99j24ScRmZlVAoLQaobfocsiCJDcBYOgcDwSPiZDvPxtBqlTQJGgYe/vqv70nr/0ikXaLTAj93ezwG6V1+WLBIUr47tnPjebHomOkpbNttq0j2CXgkwoGqJSIlvpHna9GzSMQLIqB9Pn/dCfY+9JkyWm4pJZkYFpdP0NAW1nMInGUbRUfgvV/gZn237oQ2T31b6gVKPje+AXjIIeiK9JJx/K14hQRX4hASQvFZXy1A/;25:/hHSPbGfwJaMEcKR+hEtBzrF93hQ9MdLrJlxZoKWQYAYIV7COR44PditJ0/73QlwZDyo/i3YNT7qzxRPNPIPdhS7UTc/6V7v8XPIaZ4FnwVxnneyO5SA/nNCnaGhPEU14Z4eHR/dm7OClenvFFM6zhhgNbbyRTxE1+W1xb9qBMHtL2D1tAAeWsXo3/g1zcb3qTt9vioik4TUAfxbYZkmrDQPxat+1DGvTXRbCic/VKe9A1na27uiz3WpqlTpy4JrCgDYao9UoK99H522xGg4paAVNc6GZ/JEJka+c0LmPWzLd4SPu+mrUV0TOwmmS4gEpBrbO3M29cZa2jaOmOXWYQ==;31:+X2c086P6aZQ96gZq9NXhNR8NO4NNbCPgmXRN4etNfDbOEBlSxKoU+zwE2qZp5sNBWpBP1Fa6c/+DDi6s2MC3awFdnJNmDL6ZKredzKVvg8EWjOK65NQEMheOXx1Q40UvXqJGJCTeF3ozcs9eImStHCFppK8Gb5UKCpERtOQliIwUDwTbOnKvRgXK9iOrUaKfIZGrnZr6cZGy8p2TCsm5pF5Z5jdq4tuzl7a7UDmwT4= X-MS-TrafficTypeDiagnostic: DM5PR07MB2780: X-Microsoft-Exchange-Diagnostics: 1;DM5PR07MB2780;20:cUTzCmP/zXEU0l9lpneMTRvwQ1A6ryZMeV7C6ZEBKSZKP4KgTFlmBAzt1JUo+GJBnLxoF8hBqUCL9ddkeQ++foeUpwA/kzzdUWLp+zlx5NfCASOu9A29pLR0pgaFzY4U/uAG7qTv7PsBW2FSWNTG1vL+DUEye5EqfK9HVy9nWnfQ3sIooL/K9O0JqAthDcxX5D6MRViZqTLsRCldw/nBhKI4Hmd35jiWaTgdODhhFLiZaTMxvC2lw+QTjbWabrUvgTU2yDpeNazdYTUHbAg4n3uKeYgJ3hYUQm3dBa0e6h6NztZLhGOs5owbjufasXTDDs5iulTQZ2v2nyZ+OThI/SOCwEt1qrOBKau0KVQRsf8TgIr7xUvLcYd5T6Y3EgrnDRfLMosUABjHusG+EI/SKD6KG0MBzYOv6lMk3j9GtmduwG6rCgQtQHAieLbsYhmzHGV/HEbiu5d8tUHNm5lz99rGzM+qwN4EbBRGJ0em5BE7tA/wCuPHnWvK5DVyJ8X+;4:VerBTC9uO9XgdFBTOFQHloyBNSp3HaK/rnuE6ikM1T8lKBrUp7Oprg+OTKFCa/Az7x8/jGd5D/wqxH3VjwM/lTvckxjOEy2Ds+piTbraxSj9MFNfUfG9IWmwKSWLUu1QuSsLCOxj48gP1/R1YIB0cZWXL4a51TkAEhUwx3qXkZa4ZVisKkt3jpWS/h2Q7yC0yEWaFHy1RG3gexQ7JkCDVzOWy8YgitVyVCC/IuA9w+f2TS7jHRnmrC5fGHPDQ5XDaWjK9aEzXXkKKtPnD2iYyA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231023)(944501075)(93006095)(93001095)(6041268)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR07MB2780;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:DM5PR07MB2780; X-Forefront-PRVS: 0540846A1D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39860400002)(396003)(366004)(346002)(376002)(39380400002)(199004)(189003)(24454002)(83506002)(81166006)(66066001)(8676002)(4326008)(81156014)(7736002)(8936002)(316002)(106356001)(47776003)(16586007)(105586002)(1411001)(53416004)(25786009)(2906002)(58126008)(5660300001)(6666003)(478600001)(16526018)(9686003)(7696005)(52116002)(55016002)(6246003)(53936002)(6916009)(2950100002)(72206003)(68736007)(5005980100005)(3846002)(69596002)(6116002)(97736004)(229853002)(386003)(305945005)(6506007)(23726003)(59450400001)(86362001)(39060400002)(76176011);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR07MB2780;H:n5127mncfb42q1.qlogic.org;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM5PR07MB2780;23:MNYqvzNLOtqnCWw87sLZJH3NSuVXaucJ9vqD5Y2RK?= =?us-ascii?Q?zLlvrRBi3DaLZ07bKbdxCnrHYHHSigsx/+rXnJrDKsjYFgZ2hAekzt+KvHSv?= =?us-ascii?Q?IUGAfr9cFblCQzeQzjfDWRYjr7EvUE04S+0r+jVc2Z7rMj+k1kZNWWRqibn/?= =?us-ascii?Q?myFAnW48DZXZ+rjfnFMu7sToIzoktEC2ePwTjeSfB4YCK20SdHuhZD2FGtxb?= =?us-ascii?Q?RLu+5udwtOxE1W5QIQCtjIG++PYqyuwq+rFzqc1s0Nh503rPCS3cVnlqNwrH?= =?us-ascii?Q?byGQEac+FEMol6Uz8Jl61UNBk6bfKePxw9nQmkqJu7zYk9Olr1f5FWFTDWkx?= =?us-ascii?Q?U1a/4V1ezQ3diPO9zh7o2QA4RllvoxNq+K0thKOpUEKDWNseoLWMjXwGLYTy?= =?us-ascii?Q?62pAtUjQbbf0EMc9/dAf/+z6h1PmcGiriK2TgKJifHxV/TG/LZrhSdVFSe52?= =?us-ascii?Q?+dCmYwk5a6GMYQ1gJyaa+oHxpSNpW7z+5wpYma7PdnHa6f4jp8GVSdZ6skIm?= =?us-ascii?Q?FwWQsrr1mB1em8J6nms97aKMtjNO+BI/Yswvj6ZCA0OFto7yq2PNxdvmRwwM?= =?us-ascii?Q?cERQKWW2vKkfaJNXYsa9MsUe6gxicYRrmIfdX+/q662KwYaOcl1WibOpZ69z?= =?us-ascii?Q?o2RUiKcSYPu+dFCC2OHLxT3tXaXU8xb3HhEVqzl7WGJwC6K+LEEnCaCH59NW?= =?us-ascii?Q?8tXEZMvhILyVAt0fKIdt8T8vq8nz/0oqSAK2/vL5uN3WXhrGG9bjhLB8QVzi?= =?us-ascii?Q?uNohmgUyy6aHexlCTBg6iGb7h+tzkwoDkbC474UCFuCAI62X0QP1D66diw+B?= =?us-ascii?Q?bVcPJp6nM8V5zgYdHsiOU+9QKPY2tcqShYgM10F9xP8dILMuZE0r+jXT8uNK?= =?us-ascii?Q?Khg39+amlg0W081xljdtH0L4AOYkYvBFPWniCIi4/98F/pjYCc6LX+Gcc9eP?= =?us-ascii?Q?ZSxZeistdGB9ZZ5xSdV8ZM+LaSK/x/k1QTGXqS2/7QhR/T6LNWmDIK/IUBO9?= =?us-ascii?Q?c3ZA6QhpJ3QrluQjDPUVnF65rmWNltLhuhK3An5HmG2d5QSjdBr6ilctvi+Y?= =?us-ascii?Q?yPUlNPmC+95OmlmH3oN6zMOXQaHXkLTBApYJ232Fj27HcwzkvlCbsuTOyir3?= =?us-ascii?Q?bY6ulJJFastby4fcJpSacrbrqsZbfvDq2Gkv5Dh7SIv6WLb8LnNmKVTqlNWH?= =?us-ascii?Q?6jEX5l/mVhF7q5OgqXsP9IVTwPTS8ErWlg/8XfoB1WkFStTIkYq+/HseUARy?= =?us-ascii?Q?A6T5mSBsFVK7WM4PHGHYbmoEnKzTm9iItiEIhbpyEJDomGlLxkMl2FIke1dv?= =?us-ascii?B?Zz09?= X-Microsoft-Exchange-Diagnostics: 1;DM5PR07MB2780;6:+jfDMz4bYnQt6f8TkZaJfLprvqviSWSMXdAtDj3kaxChLg8y0xgSENnuaunGMrH5hol9P97keVfjh4b/xeesiAvZ5Q12VaUselxQKr7adUMM3L7nRnAf2puM3fnnpYPrFno9FLG/ITz8DPazD+dbs+UHT+D7ZZmSmvQ3kREMGyNxrSagQzlLaTYL1WH7HHesscruUvyAmzn6arGltoQX/NZO7OK9aTbfS5VbMdrjGUjOHpl2yVXoRQhKME67gkSOrujLzhN0B5EtLMCyaHC168XEdTCwT4NfG0SFEZBhwB31UACl9udvYrAcpnDYoro7WU00ks429/HtmsQEaQbZ+0A8b+KgMPNaDxyjbQPFABY=;5:RXwYLPSFrtRdJtnX7RrayVgG1N1Sqq1WlQPkr5sIKE9y7fCLuQNoNXMCRxMdr24huP0NHtqjILkJyDLGfZdRQtaw95u2OCvmiZWoo6kJ5uHRTMclJ71UOuVhTDOR6wYAAregKouT1Sog2sljoZa/G49d1ZSllGlxSicJ2w0fyVs=;24:nR6K5kAXnLZCXsUi+nJnoKEe26lEL+Dr/XkxVKQ1AUULsKoae2vQFnYLHZ1SlD38ySxO2mVZOE9Tnd8UaQgDr+gRJs8+vYA7iPITJFnbWSY=;7:llWAITSnXyxZEfu5RcKHMJwecrX6NG0ojTXif7Ofx1f7Q8G1AimnCY2fbQDxTqwrqz+gEUR1njSebvQUJ8+OegiDdCMacpOW0RcLDi/pcIHp77F2+UWXYsW+UXcTl//O/slwCLEjSJ8InS3Sw1jfOMx+w8PaZEMeJqV6REn6OWOTtye3LjNGgkol2N26OEHo1NfINk181s8dlwITrG7uJnBOWNP55qFCSEgxGTl1yylZ//p1Ea6fXo3XhOAwTkYq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jan 2018 21:14:38.2963 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0829971a-3a6f-4baf-f565-08d55225d662 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB2780 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Sat, 30 Dec 2017, 10:28am, 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/bnx2fc/bnx2fc_hwi.c | 60 +++++++++++++++++----------------------- > drivers/scsi/bnx2fc/bnx2fc_tgt.c | 51 +++++++++++++++------------------- > 2 files changed, 47 insertions(+), 64 deletions(-) > > diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c > index 26de61d..e8ae4d6 100644 > --- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c > +++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c > @@ -1857,16 +1857,15 @@ int bnx2fc_setup_task_ctx(struct bnx2fc_hba *hba) > * entries. Hence the limit with one page is 8192 task context > * entries. > */ > - hba->task_ctx_bd_tbl = dma_alloc_coherent(&hba->pcidev->dev, > - PAGE_SIZE, > - &hba->task_ctx_bd_dma, > - GFP_KERNEL); > + hba->task_ctx_bd_tbl = dma_zalloc_coherent(&hba->pcidev->dev, > + PAGE_SIZE, > + &hba->task_ctx_bd_dma, > + GFP_KERNEL); > if (!hba->task_ctx_bd_tbl) { > printk(KERN_ERR PFX "unable to allocate task context BDT\n"); > rc = -1; > goto out; > } > - memset(hba->task_ctx_bd_tbl, 0, PAGE_SIZE); > > /* > * Allocate task_ctx which is an array of pointers pointing to > @@ -1895,16 +1894,15 @@ int bnx2fc_setup_task_ctx(struct bnx2fc_hba *hba) > task_ctx_bdt = (struct regpair *)hba->task_ctx_bd_tbl; > for (i = 0; i < task_ctx_arr_sz; i++) { > > - hba->task_ctx[i] = dma_alloc_coherent(&hba->pcidev->dev, > - PAGE_SIZE, > - &hba->task_ctx_dma[i], > - GFP_KERNEL); > + hba->task_ctx[i] = dma_zalloc_coherent(&hba->pcidev->dev, > + PAGE_SIZE, > + &hba->task_ctx_dma[i], > + GFP_KERNEL); > if (!hba->task_ctx[i]) { > printk(KERN_ERR PFX "unable to alloc task context\n"); > rc = -1; > goto out3; > } > - memset(hba->task_ctx[i], 0, PAGE_SIZE); > addr = (u64)hba->task_ctx_dma[i]; > task_ctx_bdt->hi = cpu_to_le32((u64)addr >> 32); > task_ctx_bdt->lo = cpu_to_le32((u32)addr); > @@ -2033,28 +2031,23 @@ static int bnx2fc_allocate_hash_table(struct bnx2fc_hba *hba) > } > > for (i = 0; i < segment_count; ++i) { > - hba->hash_tbl_segments[i] = > - dma_alloc_coherent(&hba->pcidev->dev, > - BNX2FC_HASH_TBL_CHUNK_SIZE, > - &dma_segment_array[i], > - GFP_KERNEL); > + hba->hash_tbl_segments[i] = > + dma_zalloc_coherent(&hba->pcidev->dev, > + BNX2FC_HASH_TBL_CHUNK_SIZE, > + &dma_segment_array[i], > + GFP_KERNEL); > if (!hba->hash_tbl_segments[i]) { > printk(KERN_ERR PFX "hash segment alloc failed\n"); > goto cleanup_dma; > } > - memset(hba->hash_tbl_segments[i], 0, > - BNX2FC_HASH_TBL_CHUNK_SIZE); > } > > - hba->hash_tbl_pbl = dma_alloc_coherent(&hba->pcidev->dev, > - PAGE_SIZE, > - &hba->hash_tbl_pbl_dma, > - GFP_KERNEL); > + hba->hash_tbl_pbl = dma_zalloc_coherent(&hba->pcidev->dev, PAGE_SIZE, > + &hba->hash_tbl_pbl_dma, > + GFP_KERNEL); > if (!hba->hash_tbl_pbl) { > printk(KERN_ERR PFX "hash table pbl alloc failed\n"); > goto cleanup_dma; > } > - memset(hba->hash_tbl_pbl, 0, PAGE_SIZE); > > pbl = hba->hash_tbl_pbl; > for (i = 0; i < segment_count; ++i) { > @@ -2111,27 +2104,26 @@ int bnx2fc_setup_fw_resc(struct bnx2fc_hba *hba) > return -ENOMEM; > > mem_size = BNX2FC_NUM_MAX_SESS * sizeof(struct regpair); > - hba->t2_hash_tbl_ptr = dma_alloc_coherent(&hba->pcidev->dev, mem_size, > - &hba->t2_hash_tbl_ptr_dma, > - GFP_KERNEL); > + hba->t2_hash_tbl_ptr = dma_zalloc_coherent(&hba->pcidev->dev, > + mem_size, > + &hba->t2_hash_tbl_ptr_dma, > + GFP_KERNEL); > if (!hba->t2_hash_tbl_ptr) { > printk(KERN_ERR PFX "unable to allocate t2 hash table ptr\n"); > bnx2fc_free_fw_resc(hba); > return -ENOMEM; > } > - memset(hba->t2_hash_tbl_ptr, 0x00, mem_size); > > mem_size = BNX2FC_NUM_MAX_SESS * > sizeof(struct fcoe_t2_hash_table_entry); > - hba->t2_hash_tbl = dma_alloc_coherent(&hba->pcidev->dev, mem_size, > - &hba->t2_hash_tbl_dma, > - GFP_KERNEL); > + hba->t2_hash_tbl = dma_zalloc_coherent(&hba->pcidev->dev, mem_size, > + &hba->t2_hash_tbl_dma, > + GFP_KERNEL); > if (!hba->t2_hash_tbl) { > printk(KERN_ERR PFX "unable to allocate t2 hash table\n"); > bnx2fc_free_fw_resc(hba); > return -ENOMEM; > } > - memset(hba->t2_hash_tbl, 0x00, mem_size); > for (i = 0; i < BNX2FC_NUM_MAX_SESS; i++) { > addr = (unsigned long) hba->t2_hash_tbl_dma + > ((i+1) * sizeof(struct fcoe_t2_hash_table_entry)); > @@ -2148,16 +2140,14 @@ int bnx2fc_setup_fw_resc(struct bnx2fc_hba *hba) > return -ENOMEM; > } > > - hba->stats_buffer = dma_alloc_coherent(&hba->pcidev->dev, > - PAGE_SIZE, > - &hba->stats_buf_dma, > - GFP_KERNEL); > + hba->stats_buffer = dma_zalloc_coherent(&hba->pcidev->dev, PAGE_SIZE, > + &hba->stats_buf_dma, > + GFP_KERNEL); > if (!hba->stats_buffer) { > printk(KERN_ERR PFX "unable to alloc Stats Buffer\n"); > bnx2fc_free_fw_resc(hba); > return -ENOMEM; > } > - memset(hba->stats_buffer, 0x00, PAGE_SIZE); > > return 0; > } > diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c > index a8ae1a0..e3d1c7c 100644 > --- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c > +++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c > @@ -672,56 +672,52 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, > tgt->sq_mem_size = (tgt->sq_mem_size + (CNIC_PAGE_SIZE - 1)) & > CNIC_PAGE_MASK; > > - tgt->sq = dma_alloc_coherent(&hba->pcidev->dev, tgt->sq_mem_size, > - &tgt->sq_dma, GFP_KERNEL); > + tgt->sq = dma_zalloc_coherent(&hba->pcidev->dev, tgt->sq_mem_size, > + &tgt->sq_dma, GFP_KERNEL); > if (!tgt->sq) { > printk(KERN_ERR PFX "unable to allocate SQ memory %d\n", > tgt->sq_mem_size); > goto mem_alloc_failure; > } > - memset(tgt->sq, 0, tgt->sq_mem_size); > > /* Allocate and map CQ */ > tgt->cq_mem_size = tgt->max_cqes * BNX2FC_CQ_WQE_SIZE; > tgt->cq_mem_size = (tgt->cq_mem_size + (CNIC_PAGE_SIZE - 1)) & > CNIC_PAGE_MASK; > > - tgt->cq = dma_alloc_coherent(&hba->pcidev->dev, tgt->cq_mem_size, > - &tgt->cq_dma, GFP_KERNEL); > + tgt->cq = dma_zalloc_coherent(&hba->pcidev->dev, tgt->cq_mem_size, > + &tgt->cq_dma, GFP_KERNEL); > if (!tgt->cq) { > printk(KERN_ERR PFX "unable to allocate CQ memory %d\n", > tgt->cq_mem_size); > goto mem_alloc_failure; > } > - memset(tgt->cq, 0, tgt->cq_mem_size); > > /* Allocate and map RQ and RQ PBL */ > tgt->rq_mem_size = tgt->max_rqes * BNX2FC_RQ_WQE_SIZE; > tgt->rq_mem_size = (tgt->rq_mem_size + (CNIC_PAGE_SIZE - 1)) & > CNIC_PAGE_MASK; > > - tgt->rq = dma_alloc_coherent(&hba->pcidev->dev, tgt->rq_mem_size, > - &tgt->rq_dma, GFP_KERNEL); > + tgt->rq = dma_zalloc_coherent(&hba->pcidev->dev, tgt->rq_mem_size, > + &tgt->rq_dma, GFP_KERNEL); > if (!tgt->rq) { > printk(KERN_ERR PFX "unable to allocate RQ memory %d\n", > tgt->rq_mem_size); > goto mem_alloc_failure; > } > - memset(tgt->rq, 0, tgt->rq_mem_size); > > tgt->rq_pbl_size = (tgt->rq_mem_size / CNIC_PAGE_SIZE) * sizeof(void *); > tgt->rq_pbl_size = (tgt->rq_pbl_size + (CNIC_PAGE_SIZE - 1)) & > CNIC_PAGE_MASK; > > - tgt->rq_pbl = dma_alloc_coherent(&hba->pcidev->dev, tgt->rq_pbl_size, > - &tgt->rq_pbl_dma, GFP_KERNEL); > + tgt->rq_pbl = dma_zalloc_coherent(&hba->pcidev->dev, tgt->rq_pbl_size, > + &tgt->rq_pbl_dma, GFP_KERNEL); > if (!tgt->rq_pbl) { > printk(KERN_ERR PFX "unable to allocate RQ PBL %d\n", > tgt->rq_pbl_size); > goto mem_alloc_failure; > } > > - memset(tgt->rq_pbl, 0, tgt->rq_pbl_size); > num_pages = tgt->rq_mem_size / CNIC_PAGE_SIZE; > page = tgt->rq_dma; > pbl = (u32 *)tgt->rq_pbl; > @@ -739,44 +735,43 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, > tgt->xferq_mem_size = (tgt->xferq_mem_size + (CNIC_PAGE_SIZE - 1)) & > CNIC_PAGE_MASK; > > - tgt->xferq = dma_alloc_coherent(&hba->pcidev->dev, tgt->xferq_mem_size, > - &tgt->xferq_dma, GFP_KERNEL); > + tgt->xferq = dma_zalloc_coherent(&hba->pcidev->dev, > + tgt->xferq_mem_size, &tgt->xferq_dma, > + GFP_KERNEL); > if (!tgt->xferq) { > printk(KERN_ERR PFX "unable to allocate XFERQ %d\n", > tgt->xferq_mem_size); > goto mem_alloc_failure; > } > - memset(tgt->xferq, 0, tgt->xferq_mem_size); > > /* Allocate and map CONFQ & CONFQ PBL */ > tgt->confq_mem_size = tgt->max_sqes * BNX2FC_CONFQ_WQE_SIZE; > tgt->confq_mem_size = (tgt->confq_mem_size + (CNIC_PAGE_SIZE - 1)) & > CNIC_PAGE_MASK; > > - tgt->confq = dma_alloc_coherent(&hba->pcidev->dev, tgt->confq_mem_size, > - &tgt->confq_dma, GFP_KERNEL); > + tgt->confq = dma_zalloc_coherent(&hba->pcidev->dev, > + tgt->confq_mem_size, &tgt->confq_dma, > + GFP_KERNEL); > if (!tgt->confq) { > printk(KERN_ERR PFX "unable to allocate CONFQ %d\n", > tgt->confq_mem_size); > goto mem_alloc_failure; > } > - memset(tgt->confq, 0, tgt->confq_mem_size); > > tgt->confq_pbl_size = > (tgt->confq_mem_size / CNIC_PAGE_SIZE) * sizeof(void *); > tgt->confq_pbl_size = > (tgt->confq_pbl_size + (CNIC_PAGE_SIZE - 1)) & CNIC_PAGE_MASK; > > - tgt->confq_pbl = dma_alloc_coherent(&hba->pcidev->dev, > - tgt->confq_pbl_size, > - &tgt->confq_pbl_dma, GFP_KERNEL); > + tgt->confq_pbl = dma_zalloc_coherent(&hba->pcidev->dev, > + tgt->confq_pbl_size, > + &tgt->confq_pbl_dma, GFP_KERNEL); > if (!tgt->confq_pbl) { > printk(KERN_ERR PFX "unable to allocate CONFQ PBL %d\n", > tgt->confq_pbl_size); > goto mem_alloc_failure; > } > > - memset(tgt->confq_pbl, 0, tgt->confq_pbl_size); > num_pages = tgt->confq_mem_size / CNIC_PAGE_SIZE; > page = tgt->confq_dma; > pbl = (u32 *)tgt->confq_pbl; > @@ -792,15 +787,14 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, > /* Allocate and map ConnDB */ > tgt->conn_db_mem_size = sizeof(struct fcoe_conn_db); > > - tgt->conn_db = dma_alloc_coherent(&hba->pcidev->dev, > - tgt->conn_db_mem_size, > - &tgt->conn_db_dma, GFP_KERNEL); > + tgt->conn_db = dma_zalloc_coherent(&hba->pcidev->dev, > + tgt->conn_db_mem_size, > + &tgt->conn_db_dma, GFP_KERNEL); > if (!tgt->conn_db) { > printk(KERN_ERR PFX "unable to allocate conn_db %d\n", > tgt->conn_db_mem_size); > goto mem_alloc_failure; > } > - memset(tgt->conn_db, 0, tgt->conn_db_mem_size); > > > /* Allocate and map LCQ */ > @@ -808,15 +802,14 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba, > tgt->lcq_mem_size = (tgt->lcq_mem_size + (CNIC_PAGE_SIZE - 1)) & > CNIC_PAGE_MASK; > > - tgt->lcq = dma_alloc_coherent(&hba->pcidev->dev, tgt->lcq_mem_size, > - &tgt->lcq_dma, GFP_KERNEL); > + tgt->lcq = dma_zalloc_coherent(&hba->pcidev->dev, tgt->lcq_mem_size, > + &tgt->lcq_dma, GFP_KERNEL); > > if (!tgt->lcq) { > printk(KERN_ERR PFX "unable to allocate lcq %d\n", > tgt->lcq_mem_size); > goto mem_alloc_failure; > } > - memset(tgt->lcq, 0, tgt->lcq_mem_size); > > tgt->conn_db->rq_prod = 0x8000; > > Conversion looks sane. Acked-by: Chad Dupuis