diff mbox series

[v2] scsi: qla2xxx: Simplify conditional check again

Message ID 20190326220444.10040-1-natechancellor@gmail.com (mailing list archive)
State Mainlined
Commit 46333cebe77883ff38be59c3e7200c5a5145d6ee
Headers show
Series [v2] scsi: qla2xxx: Simplify conditional check again | expand

Commit Message

Nathan Chancellor March 26, 2019, 10:04 p.m. UTC
Clang warns when it sees a logical not on the left side of a
conditional statement because it thinks the logical not should
be applied to the whole statement, not just the left side:

drivers/scsi/qla2xxx/qla_nx.c:3703:7: warning: logical not is only
applied to the left hand side of this comparison
[-Wlogical-not-parentheses]

This particular instance was already fixed by commit 0bfe7d3cae58 ("scsi:
qla2xxx: Simplify conditional check") upstream but it was reintroduced
by commit 3695310e37b4 ("scsi: qla2xxx: Update flash read/write
routine") in the 5.2/scsi-queue.

Fixes: 3695310e37b4 ("scsi: qla2xxx: Update flash read/write routine")
Link: https://github.com/ClangBuiltLinux/linux/issues/80
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---

v1 -> v2:

* Reword commit message so make it clear this is just a reapplication of
  a commit that is already in mainline, as suggested by Nick.

* Include the authors who reintroduced this warning.

 drivers/scsi/qla2xxx/qla_nx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Nick Desaulniers March 27, 2019, 5:01 p.m. UTC | #1
On Tue, Mar 26, 2019 at 3:06 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> Clang warns when it sees a logical not on the left side of a
> conditional statement because it thinks the logical not should
> be applied to the whole statement, not just the left side:
>
> drivers/scsi/qla2xxx/qla_nx.c:3703:7: warning: logical not is only
> applied to the left hand side of this comparison
> [-Wlogical-not-parentheses]
>
> This particular instance was already fixed by commit 0bfe7d3cae58 ("scsi:
> qla2xxx: Simplify conditional check") upstream but it was reintroduced
> by commit 3695310e37b4 ("scsi: qla2xxx: Update flash read/write
> routine") in the 5.2/scsi-queue.

Nathan, thanks for following up and rewording the commit message to
clearly state how we got here.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

>
> Fixes: 3695310e37b4 ("scsi: qla2xxx: Update flash read/write routine")
> Link: https://github.com/ClangBuiltLinux/linux/issues/80
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>
> v1 -> v2:
>
> * Reword commit message so make it clear this is just a reapplication of
>   a commit that is already in mainline, as suggested by Nick.
>
> * Include the authors who reintroduced this warning.
>
>  drivers/scsi/qla2xxx/qla_nx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
> index e0b4387fd6ba..359ebb634d96 100644
> --- a/drivers/scsi/qla2xxx/qla_nx.c
> +++ b/drivers/scsi/qla2xxx/qla_nx.c
> @@ -3700,8 +3700,8 @@ qla82xx_chip_reset_cleanup(scsi_qla_host_t *vha)
>                 spin_unlock_irqrestore(&ha->hardware_lock, flags);
>
>                 /* Wait for pending cmds (physical and virtual) to complete */
> -               if (!qla2x00_eh_wait_for_pending_commands(vha, 0, 0,
> -                   WAIT_HOST) == QLA_SUCCESS) {
> +               if (qla2x00_eh_wait_for_pending_commands(vha, 0, 0,
> +                   WAIT_HOST)) {
>                         ql_dbg(ql_dbg_init, vha, 0x00b3,
>                             "Done wait for "
>                             "pending commands.\n");
> --
> 2.21.0
>
Martin K. Petersen March 28, 2019, 1:28 a.m. UTC | #2
Nathan,

> Clang warns when it sees a logical not on the left side of a
> conditional statement because it thinks the logical not should be
> applied to the whole statement, not just the left side:

Applied to 5.2/scsi-queue, thanks.
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index e0b4387fd6ba..359ebb634d96 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -3700,8 +3700,8 @@  qla82xx_chip_reset_cleanup(scsi_qla_host_t *vha)
 		spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
 		/* Wait for pending cmds (physical and virtual) to complete */
-		if (!qla2x00_eh_wait_for_pending_commands(vha, 0, 0,
-		    WAIT_HOST) == QLA_SUCCESS) {
+		if (qla2x00_eh_wait_for_pending_commands(vha, 0, 0,
+		    WAIT_HOST)) {
 			ql_dbg(ql_dbg_init, vha, 0x00b3,
 			    "Done wait for "
 			    "pending commands.\n");