Skip to contentSkip to conversation

scsi: sli4: Remove code duplication

PATCH Applied [email protected] 3 participants 4 messages Aug 17, 2023 – Aug 25, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 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. Also, params->s_id shall not be equal to U32_MAX. Therefore removing the unused code.

This fixes coccinelle warning such as:
drivers/scsi/elx/libefc_sli/sli4.c:2320:2-4: WARNING: possible condition with no effect (if == else)

---
v1->v2
Modified patch and the corrected the warnings using checkpatch. v2->v3
Modified patch details keeping HW descriptor variable.

---
 drivers/scsi/elx/libefc_sli/sli4.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/scsi/elx/libefc_sli/sli4.c +2 -6
index 8f96049f62dd..5e7fb110bc3f 100644
@@ -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
Acked-by on v3 1/1
#1 lore raw
Quoted 7 lines · On 8/17/23 04:43, [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. Also, params->s_id shall not be equal to U32_MAX. Therefore removing the unused code.

This fixes coccinelle warning such as:

Thanks for that. ^^^^^

Quoted 4 lines

drivers/scsi/elx/libefc_sli/sli4.c:2320:2-4: WARNING: possible condition with no effect (if == else)

Based on feedback from Broadcom people,

Thanks.

Quoted 29 lines

---
v1->v2
Modified patch and the corrected the warnings using checkpatch. v2->v3
Modified patch details keeping HW descriptor variable.

---
 drivers/scsi/elx/libefc_sli/sli4.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/scsi/elx/libefc_sli/sli4.c +2 -6
index 8f96049f62dd..5e7fb110bc3f 100644
@@ -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 · 5 lines
~Randy
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
#2 lore raw
In reply to [email protected]
Quoted 5 lines

In the function sli_xmit_bls_rsp64_wqe, the 'if' and 'else' conditions evaluates the same expression and gives same output. Also, params->s_id shall not be equal to U32_MAX. Therefore removing the unused code.

Applied to 6.6/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#3 lore raw
In reply to [email protected]
Quoted 9 lines · On Thu, 17 Aug 2023 17:13:01 +0530, [email protected] wrote:

In the function sli_xmit_bls_rsp64_wqe, the 'if' and 'else' conditions evaluates the same expression and gives same output. Also, params->s_id shall not be equal to U32_MAX. Therefore removing the unused code.

This fixes coccinelle warning such as:
drivers/scsi/elx/libefc_sli/sli4.c:2320:2-4: WARNING: possible condition with no effect (if == else)

[...]

Applied to 6.6/scsi-queue, thanks!

[1/1] scsi: sli4: Remove code duplication

      https://git.kernel.org/mkp/scsi/c/2d6f70fe175e
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering