scsi: sli4: Remove code duplication
Subsystems (3)
PATCH 1/1 scsi: sli4: Remove code duplication
From: Rajeshwar R Shinde <[email protected]>
In the function sli_xmit_bls_rsp64_wqe, the 'if' and 'else' conditions evaluates the same expression and gives same output. So removing the redundant code duplication to optimise the code.
This fixes warning such as:
drivers/scsi/elx/libefc_sli/sli4.c:2320:2-4: WARNING: possible condition with no effect (if == else)
--- drivers/scsi/elx/libefc_sli/sli4.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/scsi/elx/libefc_sli/sli4.c +2 -6
@@ -2317,12 +2317,8 @@ sli_xmit_bls_rsp64_wqe(struct sli4 *sli, void *buf,SLI4_GENERIC_CONTEXT_VPI <<SLI4_BLS_RSP_WQE_CT_SHFT ; bls->context_tag =cpu_to_le16 (params->vpi); -if (params->s_id !=U32_MAX ) - bls->local_n_port_id_dword |= -cpu_to_le32 (params->s_id &0x00ffffff ); -else - bls->local_n_port_id_dword |= -cpu_to_le32 (params->s_id &0x00ffffff ); + bls->local_n_port_id_dword |= +cpu_to_le32 (params->s_id &0x00ffffff ); dw_ridflags = (dw_ridflags & ~SLI4_BLS_RSP_RID ) | (params->d_id &SLI4_BLS_RSP_RID );
Signature · 6 lines
2.25.1 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Hi--
Quoted 8 lines · On 8/16/23 01:50, [email protected] wrote:
From: Rajeshwar R Shinde <[email protected]>
In the function
sli_xmit_bls_rsp64_wqe, the 'if' and 'else' conditions evaluates the same expression and gives same output. So removing the redundant code duplication to optimise the code.This fixes warning such as:
drivers/scsi/elx/libefc_sli/sli4.c:2320:2-4: WARNING: possible condition with no effect (if == else)
What tool produces this message?
Quoted 11 lines
Signed-off-by Rajeshwar R Shinde <[email protected]>--- drivers/scsi/elx/libefc_sli/sli4.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/scsi/elx/libefc_sli/sli4.c +0
-0@@ -2317,12 +2317,8 @@ sli_xmit_bls_rsp64_wqe(struct sli4 *sli, void *buf,SLI4_GENERIC_CONTEXT_VPI <<SLI4_BLS_RSP_WQE_CT_SHFT ;
drivers/scsi/elx/libefc_sli/sli4.c sli_xmit_bls_rsp64_wqe(struct sli4 *sli, void *buf, · line 2321
Quoted 10 lines
drivers/scsi/elx/libefc_sli/sli4.c +2
-6bls->context_tag =cpu_to_le16 (params->vpi); -if (params->s_id !=U32_MAX ) - bls->local_n_port_id_dword |= -cpu_to_le32 (params->s_id &0x00ffffff ); -else - bls->local_n_port_id_dword |= -cpu_to_le32 (params->s_id &0x00ffffff ); + bls->local_n_port_id_dword |= +cpu_to_le32 (params->s_id &0x00ffffff );
That could be correct. Or there could be a bug there. Who knows? I don't.
But maybe it doesn't matter since AFAICT that field isn't used anywhere after it is set.
Quoted 3 lines
drivers/scsi/elx/libefc_sli/sli4.c +0
-0dw_ridflags = (dw_ridflags & ~SLI4_BLS_RSP_RID ) | (params->d_id &SLI4_BLS_RSP_RID );
Signature · 5 lines
~Randy _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Ram Kishore Vegesna via Linux-kernel-mentees
Reviewed-by Ram VegesnaQuoted 47 lines · Randy Dunlap
Hi--
Quoted 4 lines · On 8/16/23 01:50, [email protected] wrote:
From: Rajeshwar R Shinde <[email protected]>
In the function
sli_xmit_bls_rsp64_wqe, the 'if' and 'else' conditions evaluates the same expression and gives same output. So removing theredundant
Quoted 4 lines
code duplication to optimise the code.
This fixes warning such as:
drivers/scsi/elx/libefc_sli/sli4.c:2320:2-4: WARNING: possible conditionwith no effect (if == else)
What tool produces this message?
Review
Quoted 6 lines
Signed-off-by Rajeshwar R Shinde <[email protected]>--- drivers/scsi/elx/libefc_sli/sli4.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/scsi/elx/libefc_sli/sli4.cdrivers/scsi/elx/libefc_sli/sli4.c sli_xmit_bls_rsp64_wqe(struct sli4 *sli, void
Quoted 4 lines
index
8f96049f62dd..5e7fb110bc3f100644drivers/scsi/elx/libefc_sli/sli4.c +0
-0@@ -2317,12 +2317,8 @@ sli_xmit_bls_rsp64_wqe(struct sli4 *sli, void*buf,
drivers/scsi/elx/libefc_sli/sli4.c sli_xmit_bls_rsp64_wqe(struct sli4 *sli, void *buf, · line 2321
Quoted 11 lines
drivers/scsi/elx/libefc_sli/sli4.c +2
-6SLI4_GENERIC_CONTEXT_VPI <<SLI4_BLS_RSP_WQE_CT_SHFT ; bls->context_tag =cpu_to_le16 (params->vpi); -if (params->s_id !=U32_MAX ) - bls->local_n_port_id_dword |= -cpu_to_le32 (params->s_id &0x00ffffff ); -else - bls->local_n_port_id_dword |= -cpu_to_le32 (params->s_id &0x00ffffff ); + bls->local_n_port_id_dword |= +cpu_to_le32 (params->s_id &0x00ffffff );That could be correct. Or there could be a bug there. Who knows? I don't.
But maybe it doesn't matter since AFAICT that field isn't used anywhere after it is set.
Quoted 1 line
Quoted 6 lines
Quoted 2 lines
dw_ridflags= (dw_ridflags& ~SLI4_BLS_RSP_RID) |
(params->d_id&SLI4_BLS_RSP_RID);--
~Randy
The expectation here is that the s_id will be valid when the RPI
is not registered.
This value will be used as the S_ID for the BLS reply sequence.
Change looks good.
Signature · 11 lines
This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees