Re: Kernel bugs found using inspect tool

From: almesber@lrc.di.epfl.ch
Date: Wed Feb 23 2000 - 09:20:15 EST


Peter T. Breuer wrote:
> It would be even nicer if someone wrote
>
> aal5 = (vcc->qos.aal == ATM_AAL5);
> if (!aal5) { ...

Taking the assignment out of the if sounds like a good idea. Adding
parentheses much less so. If people find C's precendence rules difficult
to understand, it doesn't help to give them examples where precedence is
enforced by redundant parentheses as if to suggest they were necessary,
particularly if the intended meaning is obvious (which, I agree, may not
be the case in the original code).

> or even used a switch, since it's that kind of thing here.

Not quite - the hardware doesn't know anything but AAL5 or non-AAL5.

> Maybe it's just me, but this routine has if(aal5) all the way through,
> and should probably be split into two.

Then you'd also duplicate a lot of other, common, and quite hairy code.
The driver is complex enough already ...

- Werner

-- 
  _________________________________________________________________________
 / Werner Almesberger, ICA, EPFL, CH       werner.almesberger@ica.epfl.ch /
/_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/

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



This archive was generated by hypermail 2b29 : Wed Feb 23 2000 - 21:00:33 EST