if_iwm - Check sc->sc_attached flag in suspend/resume callbacks.

* There is (almost) nothing to do in suspend/resume if if_iwm has failed
during initialization (e.g. because of firmware load failure) and was
already uninitialized by iwm_detach_local().

Submitted by:	Augustin Cavalier <waddlesplash@gmail.com> (Haiku)
Obtained from:	DragonFlyBSD (67b5e090efb225654815fed91020db6cfc16bb19)
This commit is contained in:
Kyle Evans 2019-01-24 03:42:59 +00:00
parent 544b40d85e
commit 797b6586c6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343376

View File

@ -6301,6 +6301,10 @@ iwm_resume(device_t dev)
* PCI Tx retries from interfering with C3 CPU state.
*/
pci_write_config(dev, PCI_CFG_RETRY_TIMEOUT, 0x00, 1);
if (!sc->sc_attached)
return 0;
iwm_init_task(device_get_softc(dev));
IWM_LOCK(sc);
@ -6324,6 +6328,9 @@ iwm_suspend(device_t dev)
do_stop = !! (sc->sc_ic.ic_nrunning > 0);
if (!sc->sc_attached)
return (0);
ieee80211_suspend_all(&sc->sc_ic);
if (do_stop) {