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

From: Benjamin Herrenschmidt (benh@kernel.crashing.org)
Date: Sun Mar 02 2003 - 05:54:38 EST


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/



This archive was generated by hypermail 2b29 : Fri Mar 07 2003 - 22:00:18 EST