]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
scsi: nsp32: fix logic bug in error handling
authorArnd Bergmann <arnd@arndb.de>
Tue, 5 Sep 2017 07:51:29 +0000 (09:51 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 17 Oct 2017 02:38:44 +0000 (22:38 -0400)
gcc-8 points out a logic error that has existed since the start of the
git history:

drivers/scsi/nsp32.c: In function 'nsp32_selection_autoscsi':
drivers/scsi/nsp32.c:607:27: error: bitwise comparison always evaluates to false [-Werror=tautological-compare]
  if(((phase & BUSMON_BSY) == 1) || (phase & BUSMON_SEL) == 1) {
                           ^~

Presumably the author intended to check if one of two bits was set, so
that's what I'm changing the code to. This will obviously change the
behavior of the code, hopefully to do the right thing, but I have not
tested this or checked if the new "(phase & BUSMON_BSY) || (phase &
BUSMON_SEL)" condition should indeed be treated as a fatal error.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: GOTO Masanori <gotom@debian.or.jp>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/nsp32.c

index 107e191bf0239eb55475f84a4494111bba7a9cd8..8620ac5d6e41166a53af6254cb1e385fa5bec3d2 100644 (file)
@@ -604,7 +604,7 @@ static int nsp32_selection_autoscsi(struct scsi_cmnd *SCpnt)
         * check bus line
         */
        phase = nsp32_read1(base, SCSI_BUS_MONITOR);
-       if(((phase & BUSMON_BSY) == 1) || (phase & BUSMON_SEL) == 1) {
+       if ((phase & BUSMON_BSY) || (phase & BUSMON_SEL)) {
                nsp32_msg(KERN_WARNING, "bus busy");
                SCpnt->result = DID_BUS_BUSY << 16;
                status = 1;