Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1640123pxa; Thu, 20 Aug 2020 17:03:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPT97MXLqfS38oPq+0dy34dTeZ2syLKrA+j0AjXtB6ZEkXYdmUKKnqL5BlAUFEeIS6gnbe X-Received: by 2002:a17:906:6801:: with SMTP id k1mr377771ejr.492.1597968239531; Thu, 20 Aug 2020 17:03:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597968239; cv=none; d=google.com; s=arc-20160816; b=ldlKorkN8+pEVZW5pFxBb/vB4ogd/3ZCHcniB7NcDF76bB/9dojny5RznOYJN+xt0+ CW/a7fRjeflCbLYc4SOB+LSz4Yan8j5e1405p616CPaewTYUGf2PTCu3NbDcbDzq9Ch7 kkl/wQBMfiEKitprJpRMG4OAxxGy+sMl7lekXh0wwfE3lrTz5hvapmhJ/p0vbPAnGa56 hNHe9ebVkOu3UKQ0oTqnDx6BNTrgg8kd12ABX2tz3u7z5jOubjTqHofs9iBO+1McXdp4 J47Utnha5d8LiezkKgsQxQYbONy4cK4N88A0D24Q+w6T/qN6dVUtpR4cBuTB6JGZoJG+ X95A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=swVS7wXP2zSlH4DoWRDX+ErkfgIT7hxKvOrIIG5V9Vk=; b=BCxkD741uM2r9B7rnShp+CttI4+nWZWf8/A3VdEJUUH+1rt1MFtkvPrOVJPRPYpbzv R67mKFkPZJS3F8OdJgJyi8jclnsQbygxkB208zGFeS0F2osFEgSIeq9YEyl1jGaM4gvk E9unYkr3OK0en6jnt994p96zmvTBjLEhrMWzVgZrMG2AvdbWzU2x9Qwak0KF5dTf0FpR RW/Rwo7FY62ag7vj9Tf3VVuYf7TCxoo8fjAd+XjcgchIY9kU2r8PVX9Ce0AwfuQox7LT SWclR6MjokKqXDoTAtNQDbhNdbw37dlZFKbwAt/WAKWiUuxiZXiMeQJ+cK/PMCQcLpC7 zNTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="NQ+o/6YY"; 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 lt22si8649ejb.376.2020.08.20.17.03.36; Thu, 20 Aug 2020 17:03:59 -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="NQ+o/6YY"; 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 S1727808AbgHTX44 (ORCPT + 99 others); Thu, 20 Aug 2020 19:56:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727033AbgHTX4Q (ORCPT ); Thu, 20 Aug 2020 19:56:16 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5129FC061348; Thu, 20 Aug 2020 16:49:59 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id c15so309001wrs.11; Thu, 20 Aug 2020 16:49:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=swVS7wXP2zSlH4DoWRDX+ErkfgIT7hxKvOrIIG5V9Vk=; b=NQ+o/6YYmM9TXrGVrcg8/ZHwO5GG82G5FVoY5ua24eyWXbWxqKgW2VvNzvKQeKtM6k KcFCJZIgRmw1qlKSlm7yJGGyjcLACcGzEIFA1Co5yl9nzo3dbEF6KMAHYles+gq8/jaS r/RmGx5TQdGB0bcaZdnIeDGbwZNQLONYoG0a3llzAl4+ZduZrDrM+jewmBLW+jgh5BE+ JiJHnqAekLukPw0kXueA0O1+MO3BSU+nLeBR+qmhRjV92kebat2XjMXhL5AQ/8rX9Wls 5vGMUSXXDsrFxaIT2puCVzbmj59VF/Q5gfx9n48bqj/ITaBdbeaHLJAmpVh/yMgnLUCm KUAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=swVS7wXP2zSlH4DoWRDX+ErkfgIT7hxKvOrIIG5V9Vk=; b=BXJxcpsn/hqa7BAmdKoUB+pZWZ/+vlUMQCKy1wrf6InQgOYdd7oX0iTLzLvl7Sw26C oBFE6RuM1Vw3DC/21baHZWE1BvPBvDJkA9VUh3ek1Ni8NQcI0Pkez1b5UNpIc8Sl7oeb QTgTG8qnnkOYDlY1JzF6e7ozEallNiZvlzr7S4UYvxkST/GPOJ6P74ARBfKPI5JtyUbJ oE1MrX1AkWsLOQApBDUD1FIZX+flgy8nMxIWIQNZTcIr2NZNqp0FVxF1lLfboQMe7dOX Q+FJH1N1vgqkkFy7wLj0EPEehnQ4rF+KYBVIOqpSf/76mc74EC4Fp3pCJ2kOiuTy3SBH hK3A== X-Gm-Message-State: AOAM533s361R/wKI0qNPscR8qZNH2/DfVVzLatlRid7JeXBejf6OEVzv QeBVUqrRRQgPYmSC7acYXB4= X-Received: by 2002:adf:82d5:: with SMTP id 79mr150654wrc.282.1597967397538; Thu, 20 Aug 2020 16:49:57 -0700 (PDT) Received: from localhost.localdomain (cpc83661-brig20-2-0-cust443.3-3.cable.virginm.net. [82.28.105.188]) by smtp.gmail.com with ESMTPSA id 32sm707449wrh.18.2020.08.20.16.49.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 16:49:56 -0700 (PDT) From: Alex Dewar To: alex.dewar90@gmail.com 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 Subject: [PATCH v2] scsi: Don't call memset after dma_alloc_coherent() Date: Fri, 21 Aug 2020 00:49:52 +0100 Message-Id: <20200820234952.317313-1-alex.dewar90@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820185149.932178-1-alex.dewar90@gmail.com> References: <20200820185149.932178-1-alex.dewar90@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dma_alloc_coherent() already zeroes memory, so the extra call to memset() is unnecessary. Issue identified with Coccinelle. Signed-off-by: Alex Dewar --- 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; -- 2.28.0