linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/scsi/st.c:2967: warning: suggest parentheses around operand  of '!' or change '|' to '||' or '!' to '~'
@ 2009-05-05  7:51 Geert Uytterhoeven
  2009-05-05  8:38 ` Mikael Pettersson
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2009-05-05  7:51 UTC (permalink / raw)
  To: scsi, linux-kernel

drivers/scsi/st.c:2967: warning: suggest parentheses around operand of
'!' or change '|' to '||' or '!' to '~'

        if (cmdstatp->sense_hdr.sense_key == ILLEGAL_REQUEST &&
            !(STp->use_pf & PF_TESTED)) {
                /* Try the other possible state of Page Format if not
                   already tried */
                STp->use_pf = !STp->use_pf | PF_TESTED;
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                st_release_request(SRpnt);
                SRpnt = NULL;
                return st_int_ioctl(STp, cmd_in, arg);
        }

Looks indeed incorrect to me...

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: drivers/scsi/st.c:2967: warning: suggest parentheses around operand  of '!' or change '|' to '||' or '!' to '~'
  2009-05-05  7:51 drivers/scsi/st.c:2967: warning: suggest parentheses around operand of '!' or change '|' to '||' or '!' to '~' Geert Uytterhoeven
@ 2009-05-05  8:38 ` Mikael Pettersson
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Pettersson @ 2009-05-05  8:38 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: scsi, linux-kernel

Geert Uytterhoeven writes:
 > drivers/scsi/st.c:2967: warning: suggest parentheses around operand of
 > '!' or change '|' to '||' or '!' to '~'
 > 
 >         if (cmdstatp->sense_hdr.sense_key == ILLEGAL_REQUEST &&
 >             !(STp->use_pf & PF_TESTED)) {
 >                 /* Try the other possible state of Page Format if not
 >                    already tried */
 >                 STp->use_pf = !STp->use_pf | PF_TESTED;
 >                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 >                 st_release_request(SRpnt);
 >                 SRpnt = NULL;
 >                 return st_int_ioctl(STp, cmd_in, arg);
 >         }
 > 
 > Looks indeed incorrect to me...

I noticed that too yesterday. I believe the intention is

	STp->use_pf = (!STp->use_pf) | PF_TESTED;

which in this case (PF_TESTED is clear) is the same as

	STp->use_pf = (STp->use_pf ^ USE_PF) | PF_TESTED;

which matches the comment, or

	STp->use_pf ^= (USE_PF | PF_TESTED);

if you want to micro-optimize.

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

end of thread, other threads:[~2009-05-05  8:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-05  7:51 drivers/scsi/st.c:2967: warning: suggest parentheses around operand of '!' or change '|' to '||' or '!' to '~' Geert Uytterhoeven
2009-05-05  8:38 ` Mikael Pettersson

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