scsi: be2iscsi: Remove redundant iscsi_wrb desc memset
authorJitendra Bhivare <jitendra.bhivare@broadcom.com>
Fri, 26 Aug 2016 09:39:07 +0000 (15:09 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 31 Aug 2016 02:25:48 +0000 (22:25 -0400)
alloc_wrb_handle already does memset zero of iscsi_wrb descriptor so
remove redundant memset in WRB submission paths.

Add pwrb_handle NULL check before memsett'ing pwrb.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/be2iscsi/be_main.c
drivers/scsi/be2iscsi/be_mgmt.c

index b30db877972ce1ee1950ed7bc14337d0329ed3b5..6a6906f847dbba07ef38149a9912563d48ba3d82 100644 (file)
@@ -967,7 +967,9 @@ beiscsi_get_wrb_handle(struct hwi_wrb_context *pwrb_context,
        else
                pwrb_context->alloc_index++;
        spin_unlock_bh(&pwrb_context->wrb_lock);
-       memset(pwrb_handle->pwrb, 0, sizeof(*pwrb_handle->pwrb));
+
+       if (pwrb_handle)
+               memset(pwrb_handle->pwrb, 0, sizeof(*pwrb_handle->pwrb));
 
        return pwrb_handle;
 }
@@ -4718,7 +4720,6 @@ static int beiscsi_mtask(struct iscsi_task *task)
 
        cid = beiscsi_conn->beiscsi_conn_cid;
        pwrb = io_task->pwrb_handle->pwrb;
-       memset(pwrb, 0, sizeof(*pwrb));
 
        if (is_chip_be2_be3r(phba)) {
                AMAP_SET_BITS(struct amap_iscsi_wrb, cmdsn_itt, pwrb,
index 3ac7b88afc571853e3fee16907bcad576e39096d..b9ff9391dda74a4d6e53e2ce7238c1f93d80215d 100644 (file)
@@ -1350,7 +1350,6 @@ void beiscsi_offload_cxn_v0(struct beiscsi_offload_params *params,
 {
        struct iscsi_wrb *pwrb = pwrb_handle->pwrb;
 
-       memset(pwrb, 0, sizeof(*pwrb));
        AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb,
                      max_send_data_segment_length, pwrb,
                      params->dw[offsetof(struct amap_beiscsi_offload_params,
@@ -1422,8 +1421,6 @@ void beiscsi_offload_cxn_v2(struct beiscsi_offload_params *params,
 {
        struct iscsi_wrb *pwrb = pwrb_handle->pwrb;
 
-       memset(pwrb, 0, sizeof(*pwrb));
-
        AMAP_SET_BITS(struct amap_iscsi_target_context_update_wrb_v2,
                      max_burst_length, pwrb, params->dw[offsetof
                      (struct amap_beiscsi_offload_params,