From patchwork Tue Aug 29 18:49:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Jha X-Patchwork-Id: 9927937 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6AED7602B9 for ; Tue, 29 Aug 2017 18:50:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D2E528A23 for ; Tue, 29 Aug 2017 18:50:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B93628A22; Tue, 29 Aug 2017 18:50:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_HI, RCVD_IN_SBL_CSS, RCVD_IN_SORBS_SPAM, RCVD_IN_SORBS_WEB autolearn=no version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11EC228A23 for ; Tue, 29 Aug 2017 18:50:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751390AbdH2Stt (ORCPT ); Tue, 29 Aug 2017 14:49:49 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34770 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751291AbdH2Sti (ORCPT ); Tue, 29 Aug 2017 14:49:38 -0400 Received: by mail-pf0-f194.google.com with SMTP id p69so2857792pfk.1; Tue, 29 Aug 2017 11:49:38 -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; bh=MZxdGhgVJcNrwWtDe9+k4JM55aGRBRuHtNNZKXQTSeA=; b=ou/xOa2JWQ8IlZkeYyr3CdK7oi6uI+4iobi95dQK0blDWf2gBxDrB0eyBSgCCaWne/ VYww0J5uWHmYNLaBt0tREZ5ZCZMz+5+pg/jX+XR/aarfYJlSWjTCp39+CQc0f3yIpOCR dTFk/u70vjkq6nlAq9/a/kcZLGS9BumIqE0sAIBqOqf570lnrRvGFAcaSeSlaI0IjkoV qjFuWoeiAgqF6hpJzyTj5G9dw2Vd08PWG6OI7F/7NsH6OKVz0ahbnVUYwsHarmBoz5rl 1bAXr//qDaK/Kxgoy0pCDRlVdJFpTfifXfMNWkj77RPbQUfR3V8cKZ1ymGS9x5fDawm1 rG5A== 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; bh=MZxdGhgVJcNrwWtDe9+k4JM55aGRBRuHtNNZKXQTSeA=; b=pvfmaMU+nyR8cOU6vv01AzTfZyfezFCqwOVBMIycrM+S4cHa9Vh7wWdsjembk/VcX5 ud/58V8rL07Pen3fRBxH3LtDWuc/Uuon857xqthfPRg/It1LBuM0D+IbULEluDp79UEs fX5NhWMluUkj/vPs/8d7Z+WpNDk803ylhjoNwYoWKeW7KC0BIjRVYpxnzFLCW95gF0H3 BlgtEYyOGmBwZ7Y/xBUzJu0QTmGwi02+pfyl4FMIsEjAHjJGwu++jUdej0p0Gc0NHKP9 bNOYoeahWL7198EnMFJhtmblfNDxuN3Z/Cp9qexDPeXzACJBA63CZRI09NGl50S0/0I0 IbGw== X-Gm-Message-State: AHYfb5jaacPd+k2+zzBgkCsT7T4eM4J7cm/iLsASWuQiSSoZtiEUJKXD 37gZtTQVyoV0Y8QhM10KLA== X-Google-Smtp-Source: ADKCNb6kXQCx37C7/ICGRg9nM5X9+vlOU4wV5KecfDKhRDe4d8XYAiEqJVx/csydxGrLhRPp+w9Unw== X-Received: by 10.84.236.13 with SMTP id q13mr1591194plk.381.1504032578250; Tue, 29 Aug 2017 11:49:38 -0700 (PDT) Received: from localhost.localdomain ([103.254.204.108]) by smtp.gmail.com with ESMTPSA id 195sm5667421pgc.23.2017.08.29.11.49.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Aug 2017 11:49:37 -0700 (PDT) From: Himanshu Jha To: jejb@linux.vnet.ibm.com Cc: martin.petersen@oracle.com, kashyap.desai@broadcom.com, anil.gurumurthy@qlogic.com, sudarsana.kalluru@qlogic.com, sumit.saxena@broadcom.com, QLogic-Storage-Upstream@qlogic.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, megaraidlinux.pdl@broadcom.com, Himanshu Jha Subject: [PATCH] scsi: remove memset before memcpy Date: Wed, 30 Aug 2017 00:19:19 +0530 Message-Id: <1504032559-24969-1-git-send-email-himanshujha199640@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP calling memcpy immediately after memset with the same region of memory makes memset redundant. Signed-off-by: Himanshu Jha --- drivers/scsi/bfa/bfa_ioc.c | 1 - drivers/scsi/megaraid/megaraid_sas_fusion.c | 2 -- drivers/scsi/qla4xxx/ql4_os.c | 1 - 3 files changed, 4 deletions(-) diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c index 256f4af..c37a4be 100644 --- a/drivers/scsi/bfa/bfa_ioc.c +++ b/drivers/scsi/bfa/bfa_ioc.c @@ -2763,7 +2763,6 @@ bfa_ioc_get_type(struct bfa_ioc_s *ioc) void bfa_ioc_get_adapter_serial_num(struct bfa_ioc_s *ioc, char *serial_num) { - memset((void *)serial_num, 0, BFA_ADAPTER_SERIAL_NUM_LEN); memcpy((void *)serial_num, (void *)ioc->attr->brcd_serialnum, BFA_ADAPTER_SERIAL_NUM_LEN); diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 11bd2e6..20bbb9b 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -1505,8 +1505,6 @@ map_cmd_status(struct fusion_context *fusion, scmd->result = (DID_OK << 16) | ext_status; if (ext_status == SAM_STAT_CHECK_CONDITION) { - memset(scmd->sense_buffer, 0, - SCSI_SENSE_BUFFERSIZE); memcpy(scmd->sense_buffer, sense, SCSI_SENSE_BUFFERSIZE); scmd->result |= DRIVER_SENSE << 24; diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 64c6fa5..c87658c 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -619,7 +619,6 @@ static void qla4xxx_create_chap_list(struct scsi_qla_host *ha) goto exit_chap_list; } - memset(ha->chap_list, 0, chap_size); memcpy(ha->chap_list, chap_flash_data, chap_size); exit_chap_list: