Hi,
The iwm_firmware_load_chunk() function returns the value of the
uninitialized int error variable, when the "while (!sc->sc_fw_chunk_done)"
loop terminates immediately. I saw this happen repeatedly in the init
firmware loading during bootup. Example log output with iwm compiled with
debugging output, for an AC8260 chipset:

  iwm0: loading ucode type 1
  iwm0: could not load firmware chunk 0 (error 712)
  iwm0: failed to load init firmware
  iwm apm stop

So we should explicitly initialize the error variable to 0 in
iwm_firmware_load_chunk():

Index: sys/dev/pci/if_iwm.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v
retrieving revision 1.99
diff -u -r1.99 if_iwm.c
--- sys/dev/pci/if_iwm.c        17 Aug 2016 09:39:38 -0000      1.99
+++ sys/dev/pci/if_iwm.c        1 Sep 2016 09:17:50 -0000
@@ -3169,6 +3169,7 @@
        iwm_nic_unlock(sc);
 
        /* wait 1s for this segment to load */
+       error = 0;
        while (!sc->sc_fw_chunk_done)
                if ((error = tsleep(&sc->sc_fw, 0, "iwmfw", hz)) != 0)
                        break;

Reply via email to