tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

if_wm.c: is this a bug, or am I missing something?



I'm trying to write some bare-metal code (no OS) for a chip that
appears to be supported by if_wm.c, but for which the manufacturer's
documentation PDF is cripplingly broken, leading to my reading over
that file, trying to use it as hardware documentation of a sort...and I
see something odd which looks to me like a bug.  I'm wondering whether
it is or whether I'm just missing something.

In wm_get_swfw_semaphore, I find (lines 12961-12966 of 1.562)

        if (sc->sc_type == WM_T_80003)
                timeout = 50;
        else
                timeout = 200;

        for (timeout = 0; timeout < 200; timeout++) {

Given the first part of the for loop ("timeout = 0"), it looks to me as
though the assignments to timeout above it, and the test controlling
which assignment happens, are completely useless.  If I had to guess,
I'd guess the test and assignments were designed for a loop more like
for (;timeout>0;timeout--).

Is the bug in the code?  Or in my brain?

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index