Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1216433imc; Mon, 11 Mar 2019 08:52:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRoExOChr68XTone0yN6jz3l4rZu2dEci+wzpnz47RQdOuoZRH9DOK/zF3ZqeLwGR0oOaq X-Received: by 2002:a17:902:822:: with SMTP id 31mr34612084plk.290.1552319522039; Mon, 11 Mar 2019 08:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552319522; cv=none; d=google.com; s=arc-20160816; b=WbWlNt2qoXf0b4SzNJtio5JRWhN92m0pbkOBQD0ZCMSVEZbasm6W47cokbxKuTbBLs F0pZF4wtHGqlFkH7/mm19FsdRgwZewVPGd6Zx/l8uWqcC4gDYI0M3NBSv7ucON4sAQuU QM5sgWDcnHpEcw9sIQixdtPK04f4h4MwNkO5vWZiFdbAJr+VUy0sZHdyWfW6TWxOYvOC RLoYP58kkQITAel6F+Y/tf2TLW2z66X5YGcTtE0+4nJsKKnpH6bIY6NNuXoLA4sFD+ae DNajCWH74+NcwyQ/6oeQuqCh4kppYeKE9fQpIEa3DB5g9of29Vh9Vh3iPr3RKsbKMeNQ lByg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:subject:cc:to:from:date:message-id:dkim-signature; bh=bu4IbrWa1ZTI+K96nWVl7AHAx8DAHzjVhBaPXw8WmYQ=; b=HlGVWYAiqg4B/l5uWk+FLTwwSogO1C9RznE+37XfYJOzvhml5fNliZDDUeIW9aTaGw t7+rJBVDQMeQ55gyh93Z+c8mgjcSGqUacXhcG4dhOJ+MGxgjX4AzT3nCaDUEKKW94ysY QUIgENTP2IEyc6yRgWKTrouXsZId3KZL7AXO390DWtfbXHPCIwOpJMbShi+Hxz4bIaWb DYd6gEeSiN2m286N07b8WfOzPMf7COR6fk2JlLwxW0AwtQ4CkB5Ka7fq36KXonIBGcdG zSFkAzFoYYATjIvs2XE7rEKtLN/gYnxxE66gCFH1T+j6aJpl/nFxckEGYzBDKC4pNtGa BnTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=msB1N2el; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g24si4931728pgl.109.2019.03.11.08.51.44; Mon, 11 Mar 2019 08:52:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=msB1N2el; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727605AbfCKPvV (ORCPT + 99 others); Mon, 11 Mar 2019 11:51:21 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:46440 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726625AbfCKPvV (ORCPT ); Mon, 11 Mar 2019 11:51:21 -0400 Received: by mail-pf1-f195.google.com with SMTP id s23so1884009pfe.13; Mon, 11 Mar 2019 08:51:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:from:to:cc:subject:mime-version:content-disposition :user-agent; bh=bu4IbrWa1ZTI+K96nWVl7AHAx8DAHzjVhBaPXw8WmYQ=; b=msB1N2elS4w879Qcmqs45axyGI85eOIJNKsbTt7tyLe0reuF/CxuVgggM+49f/5BGd paJTnU4iCPNLFAYVeObHOKP2adFQ+2wVOCfBeQaDnQoLfWDM6Bu/Ghs1kQtDTopTU5e5 f4FtLViHH3hKvuctkE8/sZnl0z8Ri/dLbw8Mcin7DdZrCNx81Pj1LjJqY/3mxleSB58a JRvMXoiJjRwpjjbbnGz8tlMl3HyRxljvUcJEVgSV6JYJ3/D3iEv5LPURcrHrrtLf6cYf tB7lq6VTvbT5cyS3EmbgA28jIHQ/4vLjV2c1ntbvLGkRZX6r8wtcJXSFYPA4UOZ5B/gH hg5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:to:cc:subject:mime-version :content-disposition:user-agent; bh=bu4IbrWa1ZTI+K96nWVl7AHAx8DAHzjVhBaPXw8WmYQ=; b=sFyahwEasFxMoAMXew2nEHy9TjoDmMfX2kTpneq7TNmwqwe4nANeHvLBTT4IxYPPIb c5Qfse/2U0xOHUTts0MBwiWAusmXQYGpL/1AMu740rl44rg39RLVY6NB+BcC51f+ZioM eRTE5v8g+braNOd1Qe2D1M/SDtrIrEf+FuqNh9X/qwvLjbCLHXFThtq6jeRLnIdTyK5M eXtu0GOL+OqU0LyCblLBJg6CSbzsC3yZLGULBCMipqSDeCE+TZFYFHpi+hVzkKhquUx6 QksEg6yrMJQn1nbrIvrAUn9PKvj/STeamqXJSKqnTGCtuvbCItNy+2433f53R1d+EuNO CkWw== X-Gm-Message-State: APjAAAVTBsS4zLvMeR9G2lMKBTpcS33xsRhm2brsC7nzpv7kJie2OUZA fUZpo4xbHmhVayW0eZX9RSQ= X-Received: by 2002:a17:902:bd97:: with SMTP id q23mr33810806pls.94.1552319480110; Mon, 11 Mar 2019 08:51:20 -0700 (PDT) Received: from sabyasachi ([2405:205:6194:e788:a4f9:f674:88cd:e152]) by smtp.gmail.com with ESMTPSA id 1sm19832053pfy.68.2019.03.11.08.51.14 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Mar 2019 08:51:19 -0700 (PDT) Message-ID: <5c8683f7.1c69fb81.e37f9.75a0@mx.google.com> X-Google-Original-Message-ID: <20190311155111.GA9038@sabyasachi.linux@gmail.com> Date: Mon, 11 Mar 2019 21:21:11 +0530 From: Sabyasachi Gupta To: akpm@linux-foundation.org Cc: aacraid@microsemi.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, jrdr.linux@gmail.com Subject: [PATCH] scsi/dpt_i2o.c: Use dma_zalloc_coherent MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replaced dma_alloc_coherent + memset with dma_zalloc_coherent Signed-off-by: Sabyasachi Gupta --- drivers/scsi/dpt_i2o.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 37de8fb..056383a 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c @@ -1370,13 +1370,12 @@ static s32 adpt_i2o_reset_hba(adpt_hba* pHba) schedule_timeout_uninterruptible(1); } while (m == EMPTY_QUEUE); - status = dma_alloc_coherent(&pHba->pDev->dev, 4, &addr, GFP_KERNEL); + status = dma_zalloc_coherent(&pHba->pDev->dev, 4, &addr, GFP_KERNEL); if(status == NULL) { adpt_send_nop(pHba, m); printk(KERN_ERR"IOP reset failed - no free memory.\n"); return -ENOMEM; } - memset(status,0,4); msg[0]=EIGHT_WORD_MSG_SIZE|SGL_OFFSET_0; msg[1]=I2O_CMD_ADAPTER_RESET<<24|HOST_TID<<12|ADAPTER_TID; @@ -2836,14 +2835,13 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba) msg=(u32 __iomem *)(pHba->msg_addr_virt+m); - status = dma_alloc_coherent(&pHba->pDev->dev, 4, &addr, GFP_KERNEL); + status = dma_zalloc_coherent(&pHba->pDev->dev, 4, &addr, GFP_KERNEL); if (!status) { adpt_send_nop(pHba, m); printk(KERN_WARNING"%s: IOP reset failed - no free memory.\n", pHba->name); return -ENOMEM; } - memset(status, 0, 4); writel(EIGHT_WORD_MSG_SIZE| SGL_OFFSET_6, &msg[0]); writel(I2O_CMD_OUTBOUND_INIT<<24 | HOST_TID<<12 | ADAPTER_TID, &msg[1]); @@ -2890,14 +2888,13 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba) pHba->reply_pool, pHba->reply_pool_pa); } - pHba->reply_pool = dma_alloc_coherent(&pHba->pDev->dev, + pHba->reply_pool = dma_zalloc_coherent(&pHba->pDev->dev, pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, &pHba->reply_pool_pa, GFP_KERNEL); if (!pHba->reply_pool) { printk(KERN_ERR "%s: Could not allocate reply pool\n", pHba->name); return -ENOMEM; } - memset(pHba->reply_pool, 0 , pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4); for(i = 0; i < pHba->reply_fifo_size; i++) { writel(pHba->reply_pool_pa + (i * REPLY_FRAME_SIZE * 4), @@ -3126,13 +3123,12 @@ static int adpt_i2o_build_sys_table(void) sys_tbl_len = sizeof(struct i2o_sys_tbl) + // Header + IOPs (hba_count) * sizeof(struct i2o_sys_tbl_entry); - sys_tbl = dma_alloc_coherent(&pHba->pDev->dev, + sys_tbl = dma_zalloc_coherent(&pHba->pDev->dev, sys_tbl_len, &sys_tbl_pa, GFP_KERNEL); if (!sys_tbl) { printk(KERN_WARNING "SysTab Set failed. Out of memory.\n"); return -ENOMEM; } - memset(sys_tbl, 0, sys_tbl_len); sys_tbl->num_entries = hba_count; sys_tbl->version = I2OVERSION; -- 2.7.4