Re: Multiple & vs. && and | vs. || bugs in 2.4 and 2.5

Benjamin Herrenschmidt (benh@kernel.crashing.org)
02 Mar 2003 11:54:38 +0100


On Sun, 2003-03-02 at 11:27, Norbert Kiesel wrote:

> linux-2.4.20/drivers/video/aty128fb.c:2534: if (!reg & LVDS_ON) {
> linux-2.4.20/drivers/video/radeonfb.c:2781: if (!lvds_gen_cntl & LVDS_ON) {

There two are single bit tests, they should probably be written
with an additional parenthesis:

if (!(reg & LVDS_ON))
if (!(lvds_gen_cntl & LVDS_ON))

Though in these specific cases, I tend to prefer writing it this way

if ((reg & LVDS_ON) == 0)
if ((lvds_gen_cntrl & LVDS_ON) == 0)

Since I'm the author of both of the above (though I'm not the driver
maintainer), feel free to send the typo fixes to Marcelo along with
Ani Joshi (driver maintainer)

Ben.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/