scsi: elx: libefc_sli: Optimize the same if/else blocks

Message ID Y7n/6ls2xpUkiGQf@ubun2204.myguest.virtualbox.org
State New
Headers
Series scsi: elx: libefc_sli: Optimize the same if/else blocks |

Commit Message

Deepak R Varma Jan. 7, 2023, 11:27 p.m. UTC
  The if and else branches have the exact same code, which then always
executes independent of the condition evaluation. Simplify the code by
removing the redundant branching.
Issue identified using the cond_no_effect Coccinelle semantic patch.

Signed-off-by: Deepak R Varma <drv@mailo.com>
---
 drivers/scsi/elx/libefc_sli/sli4.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

--
2.34.1
  

Patch

diff --git a/drivers/scsi/elx/libefc_sli/sli4.c b/drivers/scsi/elx/libefc_sli/sli4.c
index b8c048cdb17f..833fe4bd012e 100644
--- a/drivers/scsi/elx/libefc_sli/sli4.c
+++ b/drivers/scsi/elx/libefc_sli/sli4.c
@@ -2317,12 +2317,7 @@  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);