Message ID | 4AACD9E9.4000702@bitmath.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Sun, Sep 13, 2009 at 01:39:21PM +0200, Henrik Rydberg wrote: > Jaswinder Singh Rajput wrote: > > On Sun, 2009-09-13 at 01:24 +0200, Henrik Rydberg wrote: > >> Jaswinder Singh Rajput wrote: > >>> raw_w, raw_x and raw_y is used uninitialized for !raw_n > >> Thanks for the heads up, but actually not, since !raw_n also implies > >> !(ptest > PRESSURE_LOW). > >> > > > > Then can we move 'if (ptest > PRESSURE_LOW && origin)' stuff to 'if > > (raw_n)'. If not then my patch is correct. > > Yes, that's it, thanks. So this patch ought to solve the warning cleanly: > Yes, I like this one much better, applied. > >> > >> > >> I wonder how many cpu cycles in the world are spent making compilers happy. > >> > > > > It is not compiler mistake it is programming/logic mistakes. We should > > be thankful to compiler to pointing mistakes made by us. > Except in cases when the compiler is wrong... > The uninitialized-variable warnings have certainly proved their value many times > over. I was merely reflecting over the fact that the enclosing space of all such > errors could be made smaller by deduction at compile time. >
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index 2d8fc0b..3b598de 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c @@ -345,21 +345,22 @@ static int report_tp_state(struct bcm5974 *dev, int size) /* set the integrated button if applicable */ if (c->tp_type == TYPE2) ibt = raw2int(dev->tp_data[BUTTON_TYPE2]); - } - /* while tracking finger still valid, count all fingers */ - if (ptest > PRESSURE_LOW && origin) { - abs_p = ptest; - abs_w = int2bound(&c->w, raw_w); - abs_x = int2bound(&c->x, raw_x - c->x.devmin); - abs_y = int2bound(&c->y, c->y.devmax - raw_y); - while (raw_n--) { - ptest = int2bound(&c->p, raw2int(f->force_major)); - if (ptest > PRESSURE_LOW) - nmax++; - if (ptest > PRESSURE_HIGH) - nmin++; - f++; + /* while tracking finger still valid, count all fingers */ + if (ptest > PRESSURE_LOW && origin) { + abs_p = ptest; + abs_w = int2bound(&c->w, raw_w); + abs_x = int2bound(&c->x, raw_x - c->x.devmin); + abs_y = int2bound(&c->y, c->y.devmax - raw_y); + while (raw_n--) { + ptest = int2bound(&c->p, + raw2int(f->force_major)); + if (ptest > PRESSURE_LOW) + nmax++; + if (ptest > PRESSURE_HIGH) + nmin++; + f++; + } } }