All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: elx: libefc_sli: Optimize the same if/else blocks
@ 2023-01-07 23:27 Deepak R Varma
  0 siblings, 0 replies; only message in thread
From: Deepak R Varma @ 2023-01-07 23:27 UTC (permalink / raw)
  To: James Smart, Ram Vegesna, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, target-devel, linux-kernel
  Cc: Saurabh Singh Sengar, Praveen Kumar, Deepak R Varma

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(-)

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);
--
2.34.1




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-07 23:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-07 23:27 [PATCH] scsi: elx: libefc_sli: Optimize the same if/else blocks Deepak R Varma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.