Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2455622pxa; Mon, 24 Aug 2020 14:56:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHOrMKTJm7AanCuy135o37EJvsXIsObaHrQWorjLJjrznhMveXkaVuYczhwDr/TiH1kzR8 X-Received: by 2002:a17:906:e8f:: with SMTP id p15mr3760751ejf.290.1598306160774; Mon, 24 Aug 2020 14:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598306160; cv=none; d=google.com; s=arc-20160816; b=iVddzB4r7u6UJR9owoEfX7ybwrdrZvCbYf6nGO8wPwb9+kk0Uy7HgM++e/SXkKJAwd fy33DYW7lRZnObrWulzRQCCPtE0KdxFqjJjf3SEb5MAqdV2xfsUUChxJtTC6jLvLLCbS 93TQ2vdKjgvTUIYdasIFyuzZuKlU2Hqt3LlKPBVDMfAJhxKiRq4k1sgYdI7faBqCpJ+8 PnrHQN/UdjEZJCFac+391q2pQRuIaR0Bax8jU5s+uCwsZqXJfQ+vl9yFGQteNwKyA2ZT e9ym1mBARgDUcmNANsyZuvKn022ecsmNXcJArvbGfl2IjO8Xb99E13q7PQKBlJ2G6upg /WvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:subject:dkim-signature; bh=fvCy+pd4+670VEadUx/STXeESbdU05FA+XcBzh8qwhM=; b=EGnL5Pmhk6xQzEkr2Np9zvYOXFJjeaCSReNtUDrvrLbCORHoaLmU12BceBq0bDw18t DxjOurVIbSSQuFLG9q/XLxQiKoqg6k3UfCL8R8KXQCb/mOeHJC3EkIFawToen+6ljHNf i3FbXQjoMxzb0ZHgz+No2ui1A6J8ArHycELmnOlZi2Qi++wWysUxE/HyN6nfXLK8YsEV aLZelf1CeNrtnILtWiwVwpiPDQ7ZK1+k6ECO0rYt0WP8oyPBI/YhW4MHf0R/j5fedGHE /mv1DJlIpwMCi7HFuy5mWWhN4qQ+Jxtw5MUtHEAYv7DFZ1c8NJiBzXTnWVMIN4qn7AvJ YDtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=g0ldp5eh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id z13si7894349ede.279.2020.08.24.14.55.36; Mon, 24 Aug 2020 14:56:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=g0ldp5eh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726617AbgHXVw4 (ORCPT + 99 others); Mon, 24 Aug 2020 17:52:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726090AbgHXVw4 (ORCPT ); Mon, 24 Aug 2020 17:52:56 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE07AC061574; Mon, 24 Aug 2020 14:52:55 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id z9so306113wmk.1; Mon, 24 Aug 2020 14:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:cc:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=fvCy+pd4+670VEadUx/STXeESbdU05FA+XcBzh8qwhM=; b=g0ldp5ehGRJv6TOD7Dgo5dZrK1aZ9VzHX7DEHSwb/osmS5DKVm8URMmEvAqtzClwPh bbEPR+jsFS6oX3cucJgdAYTLqvvI+AguH3GEBHRjjEy6oz1EscPbBeb558408DHTqys7 HKlVT8o+fglHtwGV94F1V2GNWLj+hEPwT3VZdL1Vb1vQ6egs8MNYz7IrxWh0qt+60BeB AOJ4/YWtX5EXVZi74cpx9DGiV81y9jLH0nsJMCZnR8oAsrYOrMpOGoGt7breTnN66pqU wlss69U3QSi7Z/VJMnAFfmokP6Zh1JxPFVR8vIJPEYQpFoaMVwoEP7rEE0xPFur7x6+O TMXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=fvCy+pd4+670VEadUx/STXeESbdU05FA+XcBzh8qwhM=; b=EzEeAEi3KpH+9QSupUrDk6TQPSNi9xObb5du0IJ4ejWw8LtQUP4Ohl2tL/lTbYpIM2 pGdP/i8Rh7uTewDIyLEKJiU0w9E8luR49AVtyJUESHMMShc2hJtlTwmB3+QvpFv1rSqh QBFS+Not/Y55koMpFR9c7MrHID59EzSY6sUNJhu1ScjLWbFfC7dHuI7kDGvd/GeR6HfZ J+Jv8t9Ac1yRuk1uF6HOo0Ykw7N+XPeBaX/xa2vg+Wm/Fv5DjHdpJ2pmUU2fvL3ogBIs Hz91zzJNtEyfJyRWAkRFjxZ2ukKyLIC1lsv455DlH7Qt5CCumNGSlbPEQr8JhwfJFIv4 LdXQ== X-Gm-Message-State: AOAM531NoW9BHzNQM1HbIlIVzDL8ygDwGUADX7JlKq3TQuzfMDAHyHhQ riFqaqr42K6J+d4nDf46eRU= X-Received: by 2002:a1c:a54e:: with SMTP id o75mr1176138wme.181.1598305974420; Mon, 24 Aug 2020 14:52:54 -0700 (PDT) Received: from [192.168.0.18] (cpc83661-brig20-2-0-cust443.3-3.cable.virginm.net. [82.28.105.188]) by smtp.gmail.com with ESMTPSA id s8sm1571334wmc.1.2020.08.24.14.52.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Aug 2020 14:52:53 -0700 (PDT) Subject: Re: [PATCH v2] scsi: Don't call memset after dma_alloc_coherent() Cc: GR-QLogic-Storage-Upstream@marvell.com, jejb@linux.ibm.com, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, martin.petersen@oracle.com, njavali@marvell.com References: <20200820185149.932178-1-alex.dewar90@gmail.com> <20200820234952.317313-1-alex.dewar90@gmail.com> From: Alex Dewar Message-ID: <8f829bd7-fb2b-44af-44ea-130b08c1fd70@gmail.com> Date: Mon, 24 Aug 2020 22:52:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200820234952.317313-1-alex.dewar90@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-08-21 00:49, Alex Dewar wrote: > dma_alloc_coherent() already zeroes memory, so the extra call to > memset() is unnecessary. > > Issue identified with Coccinelle. > > Signed-off-by: Alex Dewar Gentle ping? I've just realised that this is the one we want, not the v1 I just replied to. > --- > v2: I've noticed a few other places in the scsi subsystem with this > pattern, so lets fix them all with one patch. > --- > drivers/scsi/mpt3sas/mpt3sas_base.c | 1 - > drivers/scsi/mvsas/mv_init.c | 4 ---- > drivers/scsi/pmcraid.c | 1 - > drivers/scsi/qla2xxx/qla_mbx.c | 2 -- > 4 files changed, 8 deletions(-) > > diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c > index b66d3f9b717f..36b6c0d67353 100644 > --- a/drivers/scsi/mpt3sas/mpt3sas_base.c > +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c > @@ -5259,7 +5259,6 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) > _base_release_memory_pools(ioc); > goto retry_allocation; > } > - memset(ioc->request, 0, sz); > > if (retry_sz) > ioc_err(ioc, "request pool: dma_alloc_coherent succeed: hba_depth(%d), chains_per_io(%d), frame_sz(%d), total(%d kb)\n", > diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c > index 978f5283c883..6aa2697c4a15 100644 > --- a/drivers/scsi/mvsas/mv_init.c > +++ b/drivers/scsi/mvsas/mv_init.c > @@ -246,19 +246,16 @@ static int mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost) > &mvi->tx_dma, GFP_KERNEL); > 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, 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, > 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; > > @@ -267,7 +264,6 @@ static int mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost) > &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, > diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c > index aa9ae2ae8579..d99568fdf4af 100644 > --- a/drivers/scsi/pmcraid.c > +++ b/drivers/scsi/pmcraid.c > @@ -4716,7 +4716,6 @@ static int pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance) > return -ENOMEM; > } > > - memset(pinstance->hrrq_start[i], 0, buffer_size); > pinstance->hrrq_curr[i] = pinstance->hrrq_start[i]; > pinstance->hrrq_end[i] = > pinstance->hrrq_start[i] + PMCRAID_MAX_CMD - 1; > diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c > index 226f1428d3e5..e00f604bbf7a 100644 > --- a/drivers/scsi/qla2xxx/qla_mbx.c > +++ b/drivers/scsi/qla2xxx/qla_mbx.c > @@ -4925,8 +4925,6 @@ qla25xx_set_els_cmds_supported(scsi_qla_host_t *vha) > return QLA_MEMORY_ALLOC_FAILED; > } > > - memset(els_cmd_map, 0, ELS_CMD_MAP_SIZE); > - > /* List of Purex ELS */ > cmd_opcode[0] = ELS_FPIN; > cmd_opcode[1] = ELS_RDP;