Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751416AbdH2Stt (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 X-Google-Smtp-Source: ADKCNb6kXQCx37C7/ICGRg9nM5X9+vlOU4wV5KecfDKhRDe4d8XYAiEqJVx/csydxGrLhRPp+w9Unw== 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1809 Lines: 49 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: -- 2.7.4