From 3cc50d22fd8b51d696f24e5aefdf2ee44a69a62e Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Thu, 7 Nov 2019 23:29:43 +0000 Subject: [PATCH] iwm: Call iwm_dev_check() earlier in iwm_attach(). This ensures that the driver softc reflects device capabilities as early as possible, for use by device initialization code that is conditional on certain capabilities. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- sys/dev/iwm/if_iwm.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 4c64bd916fe2..99f0d578afcf 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -5743,8 +5743,6 @@ iwm_pci_detach(device_t dev) rman_get_rid(sc->sc_mem), sc->sc_mem); } - - static int iwm_attach(device_t dev) { @@ -5761,6 +5759,10 @@ iwm_attach(device_t dev) callout_init_mtx(&sc->sc_led_blink_to, &sc->sc_mtx, 0); TASK_INIT(&sc->sc_es_task, 0, iwm_endscan_cb, sc); + error = iwm_dev_check(dev); + if (error != 0) + goto fail; + sc->sc_notif_wait = iwm_notification_wait_init(sc); if (sc->sc_notif_wait == NULL) { device_printf(dev, "failed to init notification wait struct\n"); @@ -5786,11 +5788,6 @@ iwm_attach(device_t dev) sc->sc_wantresp = -1; - /* Match device id */ - error = iwm_dev_check(dev); - if (error != 0) - goto fail; - sc->sc_hw_rev = IWM_READ(sc, IWM_CSR_HW_REV); /* * In the 8000 HW family the format of the 4 bytes of CSR_HW_REV have