Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp915690imu; Fri, 4 Jan 2019 09:25:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN5oGxgD0524ARbNk3heQJgHA6m3K8PUV1oTHsPV/I4ETJJQpv18//u6kXCpVfX1ToI5fWBL X-Received: by 2002:a63:cb4a:: with SMTP id m10mr47620563pgi.105.1546622718992; Fri, 04 Jan 2019 09:25:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546622718; cv=none; d=google.com; s=arc-20160816; b=VYRnBZF6jwmFABr5wtkFCXPw/5pcPCJflcULukaaIgeMn10Ukf3unOmkJ+N/BAws7E 7bq9dn9bm/bsIUlvtdHQ5zm6/V1Eud2laHK9j+Dchp8Tcb9cWluM3IaXR7gsDaolbqJ+ PJnicwlX+/dmISA07YjxPCVxih70x8dOgLIKthN3TbPuGQJGS5Q19ANgdv2y6RReYvzo lqFpJSCGKSHVseXV3eToccedA5rQzQPi6KoR3hGUeJ+LpE5jJ2YNZ4ZrPycUfEypxVap ryaYpJNXbIhGCQDUINiq0ZkQEJYsiU6lPDgf4mhuv2n+PINSNMgwOHSEG9cj71mmrWsT whkw== 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=Ykevx0nGBspU04Q/rzgX0xdKqM8eDjaERaoZK6Fzxc4=; b=LN84nSdlAd0eaS4bDiP22+UmTmzzQn23lWL2ZwwuGOq61+LnPOmWvsTLfIihGy5ix6 5qkFXqW/mjAIruSKiA7vJqu0Y/WBWw2BkzJhz3xG2Zne5FoysMDkTn/WWwm06MMuQeU0 46wgui4MZbXgf7LheNHd9Qswbl2LSHvIWTItg5RUaBPeZLsrcP7FkPBAqTwUI3v7qrH+ zJ7LKJXCup0aRpHefNYfKBhOXHJkISQhgD1BtbpWsAmHqSBaw1EMs6dwF+wWEWrlyouP oyia31mCu8eBBp0QT0p6PclX4E/vDXNayKlud7HJXnOouMAk4clsE8owa00SIGElOesT hMww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gcyKwfDH; 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 w5si2595177plp.208.2019.01.04.09.25.03; Fri, 04 Jan 2019 09:25:18 -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=gcyKwfDH; 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 S1727006AbfADPLt (ORCPT + 99 others); Fri, 4 Jan 2019 10:11:49 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:41585 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725939AbfADPLt (ORCPT ); Fri, 4 Jan 2019 10:11:49 -0500 Received: by mail-pg1-f195.google.com with SMTP id m1so17629003pgq.8; Fri, 04 Jan 2019 07:11:48 -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=Ykevx0nGBspU04Q/rzgX0xdKqM8eDjaERaoZK6Fzxc4=; b=gcyKwfDHMUdiYLkN76Vq5KQHFAqX1PKOS8RAbhwWn3Wju4xdYmSnHzfwmQFYTaUtZE 4n0xTtfGnSm9i3T5ARh5ZYJPgwpC1qYIn7m+PfMlFeDX3tKN3s1AGPSYPtCx+N+J2Ek6 Cp03WRRWhC0aA5m5vjsOnj8UqkHTdMmt23RsZ1ftAFZdQ6p9QRSr0AR6716H1/nvHc4D acWEB36phx7pQLEjJemnWH9mZgGepJAvzP3TupPGz+w1TWd0bcGQS+kJVz0PeH0p42OJ iHuzoOGDG5LjVJgIp93EaZc7ZzrOjxWI2MSufAO+L6yRU33Qv2YhHDCXiYx7uzUushaY LQQw== 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=Ykevx0nGBspU04Q/rzgX0xdKqM8eDjaERaoZK6Fzxc4=; b=HplIDKhHVTzt9BMGD9resPfjlNWpXBL4ng4mMTRTndclxKEGj8bqStDTyuaRWHL3S+ 7XLtSKE9Mt8srzbHYSItUakiV8jtUGoIInII47n3CtfQX6J0V32PQAely4a+7DiFO76M GbKkkO6sfjqBJDs81lL3oBdtaEd7DxdCtlYGxcPTelIE2a2OnASviRp/Jqgt1kW1wRD9 WEmy72QIL3VS3dTR89FvNKMkhDzHSvBplUojzaA+SOA3FMdmctEP0xHQXhOaY5/RsiFI 8WO37iY2mUTkYuDqwATa9jmTjKRL5TP6vD+g4BBnAjyMaoqjwheCnQtM9bF/ueyVj63d nBpg== X-Gm-Message-State: AJcUukcQVFyiC9f12pU8L+qPszp7laMJ2zUxZrsVMlqOa5+eGgiCQldF R7UlPzjfwSzmVtuVzt50nlD+CORM9xkaoZp8Vhk= X-Received: by 2002:a63:4d66:: with SMTP id n38mr49362239pgl.270.1546614707675; Fri, 04 Jan 2019 07:11:47 -0800 (PST) MIME-Version: 1.0 References: <5bf56248.1c69fb81.21a6e.5a72@mx.google.com> In-Reply-To: From: Sabyasachi Gupta Date: Fri, 4 Jan 2019 20:41:36 +0530 Message-ID: Subject: Re: [PATCH] scsi/mvsas/mv_init.c: Use dma_zalloc_coherent To: John Garry Cc: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, jthumshirn@suse.de, 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 Fri, Jan 4, 2019 at 6:43 PM John Garry wrote: > > On 04/01/2019 12:48, Sabyasachi Gupta wrote: > > On Wed, Dec 19, 2018 at 6:49 PM Sabyasachi Gupta > > wrote: > >> > >> On Sat, Dec 1, 2018 at 6:40 PM Sabyasachi Gupta > >> wrote: > >>> > >>> On Wed, Nov 21, 2018 at 7:18 PM Sabyasachi Gupta > >>> wrote: > >>>> > >>>> Replace dma_alloc_coherent + memset with dma_zalloc_coherent > >>>> > > If you're going to make this change, then how about change these to the > managed version, so that we can avoid the explicit free'ing at driver > removal? I can't get it > > >>>> Signed-off-by: Sabyasachi Gupta > >>> > >>> Any comment on this patch? > >> > >> Any comment on this patch? > > > > Any comment on this patch? > > > >> > >>> > >>>> --- > >>>> drivers/scsi/mvsas/mv_init.c | 12 ++++-------- > >>>> 1 file changed, 4 insertions(+), 8 deletions(-) > >>>> > >>>> diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c > >>>> index 3ac3437..495bddb 100644 > >>>> --- a/drivers/scsi/mvsas/mv_init.c > >>>> +++ b/drivers/scsi/mvsas/mv_init.c > >>>> @@ -253,33 +253,29 @@ static int mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost) > >>>> /* > >>>> * alloc and init our DMA areas > >>>> */ > >>>> - mvi->tx = dma_alloc_coherent(mvi->dev, > >>>> + mvi->tx = dma_zalloc_coherent(mvi->dev, > >>>> sizeof(*mvi->tx) * MVS_CHIP_SLOT_SZ, > >>>> &mvi->tx_dma, GFP_KERNEL); > > I'm guessing that this does not pass checkpatch with --strict option. > > Thanks, > John I have not not checked with --strict option > > >>>> if (!mvi->tx) > >>>> goto err_out; > >>>> - memset(mvi->tx, 0, sizeof(*mvi->tx) * MVS_CHIP_SLOT_SZ); > >>>> - mvi->rx_fis = dma_alloc_coherent(mvi->dev, MVS_RX_FISL_SZ, > >>>> + mvi->rx_fis = dma_zalloc_coherent(mvi->dev, MVS_RX_FISL_SZ, > >>>> &mvi->rx_fis_dma, GFP_KERNEL); > >>>> if (!mvi->rx_fis) > >>>> goto err_out; > >>>> - memset(mvi->rx_fis, 0, MVS_RX_FISL_SZ); > >>>> > >>>> - mvi->rx = dma_alloc_coherent(mvi->dev, > >>>> + mvi->rx = dma_zalloc_coherent(mvi->dev, > >>>> sizeof(*mvi->rx) * (MVS_RX_RING_SZ + 1), > >>>> &mvi->rx_dma, GFP_KERNEL); > >>>> if (!mvi->rx) > >>>> goto err_out; > >>>> - memset(mvi->rx, 0, sizeof(*mvi->rx) * (MVS_RX_RING_SZ + 1)); > >>>> mvi->rx[0] = cpu_to_le32(0xfff); > >>>> mvi->rx_cons = 0xfff; > >>>> > >>>> - mvi->slot = dma_alloc_coherent(mvi->dev, > >>>> + mvi->slot = dma_zalloc_coherent(mvi->dev, > >>>> sizeof(*mvi->slot) * slot_nr, > >>>> &mvi->slot_dma, GFP_KERNEL); > >>>> if (!mvi->slot) > >>>> goto err_out; > >>>> - memset(mvi->slot, 0, sizeof(*mvi->slot) * slot_nr); > >>>> > >>>> mvi->bulk_buffer = dma_alloc_coherent(mvi->dev, > >>>> TRASH_BUCKET_SIZE, > >>>> -- > >>>> 2.7.4 > >>>> > > > > . > > > >