If iwm_newstate() fails, queue the init task to reset the device.
This should prevent hangs some people have been reporting.

Tests? OK?

Index: if_iwm.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v
retrieving revision 1.217
diff -u -p -r1.217 if_iwm.c
--- if_iwm.c    26 Oct 2017 15:00:28 -0000      1.217
+++ if_iwm.c    29 Nov 2017 19:12:16 -0000
@@ -6056,8 +6056,12 @@ iwm_newstate_task(void *psc)
        }
 
 out:
-       if (err == 0 && (sc->sc_flags & IWM_FLAG_SHUTDOWN) == 0)
-               sc->sc_newstate(ic, nstate, arg);
+       if ((sc->sc_flags & IWM_FLAG_SHUTDOWN) == 0) {
+               if (err)
+                       task_add(systq, &sc->init_task);
+               else
+                       sc->sc_newstate(ic, nstate, arg);
+       }
        refcnt_rele_wake(&sc->task_refs);
        splx(s);
 }

Reply via email to