linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] scsi: qla2xxx: Simplify if condition evaluation
@ 2023-01-12  6:26 Deepak R Varma
  2023-01-22 18:30 ` Deepak R Varma
  2023-01-23 19:19 ` Himanshu Madhani
  0 siblings, 2 replies; 3+ messages in thread
From: Deepak R Varma @ 2023-01-12  6:26 UTC (permalink / raw)
  To: Nilesh Javali, GR-QLogic-Storage-Upstream, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel
  Cc: Saurabh Singh Sengar, Praveen Kumar

A logical evaluation of type (!A || A && B) can be simplified as
(!A || B).
Improvement by suggested by excluded_middle.cocci Coccinelel semantic
patch.

Signed-off-by: Deepak R Varma <drv@mailo.com>
---
Please note: Change is compile tested only.

Changes in v2:
   - Correct the if evaluation from (A && B) to (!A || B). Feedback
     from Lee Duncan <lduncan@suse.com>

 drivers/scsi/qla2xxx/qla_target.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 548f22705ddc..4f104fbfe55d 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1028,8 +1028,7 @@ void qlt_free_session_done(struct work_struct *work)
 		}
 
 		if (ha->flags.edif_enabled &&
-		    (!own || (own &&
-			      own->iocb.u.isp24.status_subcode == ELS_PLOGI))) {
+				(!own || own->iocb.u.isp24.status_subcode == ELS_PLOGI)) {
 			sess->edif.authok = 0;
 			if (!ha->flags.host_shutting_down) {
 				ql_dbg(ql_dbg_edif, vha, 0x911e,
-- 
2.34.1




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] scsi: qla2xxx: Simplify if condition evaluation
  2023-01-12  6:26 [PATCH v2] scsi: qla2xxx: Simplify if condition evaluation Deepak R Varma
@ 2023-01-22 18:30 ` Deepak R Varma
  2023-01-23 19:19 ` Himanshu Madhani
  1 sibling, 0 replies; 3+ messages in thread
From: Deepak R Varma @ 2023-01-22 18:30 UTC (permalink / raw)
  To: Nilesh Javali, GR-QLogic-Storage-Upstream, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel
  Cc: Saurabh Singh Sengar, Praveen Kumar

On Thu, Jan 12, 2023 at 11:56:46AM +0530, Deepak R Varma wrote:
> A logical evaluation of type (!A || A && B) can be simplified as
> (!A || B).
> Improvement by suggested by excluded_middle.cocci Coccinelel semantic
> patch.
> 
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---

Hello,
May I request a review and feedback comment on this patch please?

Thank you,
./drv

> Please note: Change is compile tested only.
> 
> Changes in v2:
>    - Correct the if evaluation from (A && B) to (!A || B). Feedback
>      from Lee Duncan <lduncan@suse.com>
> 
>  drivers/scsi/qla2xxx/qla_target.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
> index 548f22705ddc..4f104fbfe55d 100644
> --- a/drivers/scsi/qla2xxx/qla_target.c
> +++ b/drivers/scsi/qla2xxx/qla_target.c
> @@ -1028,8 +1028,7 @@ void qlt_free_session_done(struct work_struct *work)
>  		}
>  
>  		if (ha->flags.edif_enabled &&
> -		    (!own || (own &&
> -			      own->iocb.u.isp24.status_subcode == ELS_PLOGI))) {
> +				(!own || own->iocb.u.isp24.status_subcode == ELS_PLOGI)) {
>  			sess->edif.authok = 0;
>  			if (!ha->flags.host_shutting_down) {
>  				ql_dbg(ql_dbg_edif, vha, 0x911e,
> -- 
> 2.34.1
> 
> 
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] scsi: qla2xxx: Simplify if condition evaluation
  2023-01-12  6:26 [PATCH v2] scsi: qla2xxx: Simplify if condition evaluation Deepak R Varma
  2023-01-22 18:30 ` Deepak R Varma
@ 2023-01-23 19:19 ` Himanshu Madhani
  1 sibling, 0 replies; 3+ messages in thread
From: Himanshu Madhani @ 2023-01-23 19:19 UTC (permalink / raw)
  To: Deepak R Varma
  Cc: Nilesh Javali, GR-QLogic-Storage-Upstream, James E.J. Bottomley,
	Martin Petersen, linux-scsi, open list, Saurabh Singh Sengar,
	Praveen Kumar



> On Jan 11, 2023, at 10:26 PM, Deepak R Varma <drv@mailo.com> wrote:
> 
> A logical evaluation of type (!A || A && B) can be simplified as
> (!A || B).
> Improvement by suggested by excluded_middle.cocci Coccinelel semantic
> patch.
> 
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---
> Please note: Change is compile tested only.
> 
> Changes in v2:
>   - Correct the if evaluation from (A && B) to (!A || B). Feedback
>     from Lee Duncan <lduncan@suse.com>
> 
> drivers/scsi/qla2xxx/qla_target.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
> index 548f22705ddc..4f104fbfe55d 100644
> --- a/drivers/scsi/qla2xxx/qla_target.c
> +++ b/drivers/scsi/qla2xxx/qla_target.c
> @@ -1028,8 +1028,7 @@ void qlt_free_session_done(struct work_struct *work)
> }
> 
> if (ha->flags.edif_enabled &&
> -    (!own || (own &&
> -      own->iocb.u.isp24.status_subcode == ELS_PLOGI))) {
> + (!own || own->iocb.u.isp24.status_subcode == ELS_PLOGI)) {
> sess->edif.authok = 0;
> if (!ha->flags.host_shutting_down) {
> ql_dbg(ql_dbg_edif, vha, 0x911e,
> -- 
> 2.34.1
> 
> 
> 

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com <mailto:himanshu.madhani@oracle.com>>

-- 
Himanshu Madhani Oracle Linux Engineering


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-23 19:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-12  6:26 [PATCH v2] scsi: qla2xxx: Simplify if condition evaluation Deepak R Varma
2023-01-22 18:30 ` Deepak R Varma
2023-01-23 19:19 ` Himanshu Madhani

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