* [PATCH v3] scsi: sli4: Remove code duplication
@ 2023-08-17 11:43 coolrrsh
2023-08-17 17:24 ` Randy Dunlap
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: coolrrsh @ 2023-08-17 11:43 UTC (permalink / raw)
To: james.smart, ram.vegesna, jejb, martin.petersen, rdunlap,
linux-scsi, target-devel, linux-kernel
Cc: linux-kernel-mentees, Rajeshwar R Shinde
From: Rajeshwar R Shinde <coolrrsh@gmail.com>
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)
Signed-off-by: Rajeshwar R Shinde <coolrrsh@gmail.com>
---
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(-)
diff --git a/drivers/scsi/elx/libefc_sli/sli4.c b/drivers/scsi/elx/libefc_sli/sli4.c
index 8f96049f62dd..5e7fb110bc3f 100644
--- a/drivers/scsi/elx/libefc_sli/sli4.c
+++ b/drivers/scsi/elx/libefc_sli/sli4.c
@@ -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);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3] scsi: sli4: Remove code duplication
2023-08-17 11:43 [PATCH v3] scsi: sli4: Remove code duplication coolrrsh
@ 2023-08-17 17:24 ` Randy Dunlap
2023-08-21 20:59 ` Martin K. Petersen
2023-08-25 1:12 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Randy Dunlap @ 2023-08-17 17:24 UTC (permalink / raw)
To: coolrrsh, james.smart, ram.vegesna, jejb, martin.petersen,
linux-scsi, target-devel, linux-kernel
Cc: linux-kernel-mentees
On 8/17/23 04:43, coolrrsh@gmail.com wrote:
> From: Rajeshwar R Shinde <coolrrsh@gmail.com>
>
> 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. ^^^^^
> drivers/scsi/elx/libefc_sli/sli4.c:2320:2-4: WARNING: possible
> condition with no effect (if == else)
>
> Signed-off-by: Rajeshwar R Shinde <coolrrsh@gmail.com>
Based on feedback from Broadcom people,
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Thanks.
> ---
> 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(-)
>
> diff --git a/drivers/scsi/elx/libefc_sli/sli4.c b/drivers/scsi/elx/libefc_sli/sli4.c
> index 8f96049f62dd..5e7fb110bc3f 100644
> --- a/drivers/scsi/elx/libefc_sli/sli4.c
> +++ b/drivers/scsi/elx/libefc_sli/sli4.c
> @@ -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);
--
~Randy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] scsi: sli4: Remove code duplication
2023-08-17 11:43 [PATCH v3] scsi: sli4: Remove code duplication coolrrsh
2023-08-17 17:24 ` Randy Dunlap
@ 2023-08-21 20:59 ` Martin K. Petersen
2023-08-25 1:12 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2023-08-21 20:59 UTC (permalink / raw)
To: coolrrsh
Cc: james.smart, ram.vegesna, jejb, martin.petersen, rdunlap,
linux-scsi, target-devel, linux-kernel, linux-kernel-mentees
> 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!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] scsi: sli4: Remove code duplication
2023-08-17 11:43 [PATCH v3] scsi: sli4: Remove code duplication coolrrsh
2023-08-17 17:24 ` Randy Dunlap
2023-08-21 20:59 ` Martin K. Petersen
@ 2023-08-25 1:12 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2023-08-25 1:12 UTC (permalink / raw)
To: james.smart, ram.vegesna, jejb, rdunlap, linux-scsi, target-devel,
linux-kernel, coolrrsh
Cc: Martin K . Petersen, linux-kernel-mentees
On Thu, 17 Aug 2023 17:13:01 +0530, coolrrsh@gmail.com 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
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-25 1:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-17 11:43 [PATCH v3] scsi: sli4: Remove code duplication coolrrsh
2023-08-17 17:24 ` Randy Dunlap
2023-08-21 20:59 ` Martin K. Petersen
2023-08-25 1:12 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).