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?