Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4905447imu; Sat, 1 Dec 2018 05:26:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/XubiH8uDQzlC6SI/8crJqgsIHNpFRo/tJeu2CMXGN0n+Hx4GCOWrfeMC4kEkj6Ajemr6rI X-Received: by 2002:a17:902:4225:: with SMTP id g34mr9546757pld.152.1543670776037; Sat, 01 Dec 2018 05:26:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543670776; cv=none; d=google.com; s=arc-20160816; b=JFNxrLCzAvbkhn048LVCphG4246OPPq2G9Ew8hYXStCNXD3Q21G3hHuu+BuVglQ3su clBQNp32gEAlAiV7LT/OY7zrEaRwWpzR/QgSUtsLuSeVTpfKfYfLfnGIm8cv9BRWJ7eP 6zmx0HQy643eAlwExmrF13gcP9A2bnBHnsmB+wd0P5zq5n1DzrDEhyFkChrh0cYepgSz 786fUXh7T8mVCQx8xQ6D8VDPe4WqxSaYwyVOp26uWIvyjvjQqXRabpboY2WRdv+DKw4P uPWkz18f35kXru8pzr/GSIJ3dEl0ArSPS9FU6OPiJ8u7+AuEwUdL48MTB6/a2dUApg32 1IsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=8H4/l64B6yHC0qT8Zyx/zZ6ebwiWoIwxZUOpgj1sIbs=; b=tWWeEFbBoWiIhtL5YKheK5hv3z8m4qMxY+sD62y5V+73F/Rt+yi0j4mvTQ+A1EJE5A s31kIIia3Ejo7heud3hMIrAgpumsbNwBTZl5y3JtlphHcafAbaG7m12GkL4D9QY5LEgc QqPGVii2cy6kSnfa4Esw2voOyrbQNkQD33iVoEr+3+V5JX116hfrKLAkR/8tDsV6DKhX u2TvAJHY78UoUmisFTZlzuw6hy3UkT0TO08zrtmizV4F1NW6NiBiyQBRCb62Q4u8Myi8 Rf3wmjFwCzFgG1KyrGnbENV3r3MCRnuIVef0E3iA4nwDWhsee/7pn1S+JjWJ1jeYZ5zq C7DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JeBBXUZw; 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 e9si7486017pgm.339.2018.12.01.05.25.47; Sat, 01 Dec 2018 05:26:15 -0800 (PST) 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=JeBBXUZw; 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 S1726777AbeLBA2G (ORCPT + 99 others); Sat, 1 Dec 2018 19:28:06 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:37514 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726642AbeLBA2G (ORCPT ); Sat, 1 Dec 2018 19:28:06 -0500 Received: by mail-pg1-f193.google.com with SMTP id 80so3722527pge.4; Sat, 01 Dec 2018 05:15:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8H4/l64B6yHC0qT8Zyx/zZ6ebwiWoIwxZUOpgj1sIbs=; b=JeBBXUZw9fHclGpFB63VFyEWl88VfsPYdd/Xt9lVu6kJWl1XO/D5hGbzqiS68p/rqo iwoHEqPNBxUEQXXdgq35nxtRRyPoai/KRImW9x+mCzxnNyBe8qQZrlWYcUnh3eGgAniU TqOYjEQLlmsA/7bcEiV0lfbiZe9HuD1FVeZt12HdlW/+dKgKpIyPRmT4FCsidpV+tFF+ itQDchh7T9eZ6XsabeA2H2HvZuA+/aRSWIDvARILXjmwkYQc4uhY4VY+Da+NSsQdHKZb JX+d8oWFMCO16JQt5EUz2D7E8+qxGDHRAkbMYheFgvZFIN2fBtONBP7dD2NdR3HYWhwR vUrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8H4/l64B6yHC0qT8Zyx/zZ6ebwiWoIwxZUOpgj1sIbs=; b=Sv8qBtJJNxSrcvYqjXxvfz03QkNI1N/x8Vg8ymUhPxg6YXzf76IMKKQGaXfcGeRZkT jCsiPzdF63Q07fk1tzcnoc5UYf8KPQMmwZIGdwSXjtzAjH2xV8rhnUS9tz54KkdYYDmF /UkZUpcmXPw1ldFcmSWwzlpzqG4x2NbbKx4yzogxUteaQSc9I8lXgMJcbl8gCnxLHIkH z+mR+sEzJjUMcSnNkLM3hJ5XvQLAqMRbS2n+gzDpLdpLbeUBj9NjJhXjN0QruIyefze/ ssmAQsBQJfVeXuLiJetQxqNXQypIAp6eI7r8JTt9+7ragsJszyjMWCfVzucfZNY30BP7 2Vyw== X-Gm-Message-State: AA+aEWbjF2M5wg/0Vt7oPK/dmqda0RH0j1InCri9D0ij4EUr3CW8hJCv gmYslrnGaWLL7jPtMhpeg6ap4gJDTpthED36Bx4= X-Received: by 2002:a62:43c1:: with SMTP id l62mr9484884pfi.22.1543670135518; Sat, 01 Dec 2018 05:15:35 -0800 (PST) MIME-Version: 1.0 References: <5bf00de4.1c69fb81.7dd65.5785@mx.google.com> In-Reply-To: <5bf00de4.1c69fb81.7dd65.5785@mx.google.com> From: Sabyasachi Gupta Date: Sat, 1 Dec 2018 18:45:23 +0530 Message-ID: Subject: Re: [PATCH] scsi/dpt_i2o.c: Use dma_zalloc_coherent To: aacraid@microsemi.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com Cc: Souptick Joarder , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Brajeswar Ghosh Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 17, 2018 at 6:17 PM Sabyasachi Gupta wrote: > > Replaced dma_alloc_coherent + memset with dma_zalloc_coherent > > Signed-off-by: Sabyasachi Gupta Any comment on this patch? > --- > 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 >