summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/athn.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/dev/ic/athn.c b/sys/dev/ic/athn.c
index aade2d87140..3f82d3e7af0 100644
--- a/sys/dev/ic/athn.c
+++ b/sys/dev/ic/athn.c
@@ -1,4 +1,4 @@
-/* $NetBSD: athn.c,v 1.16 2017/04/11 17:27:54 jmcneill Exp $ */
+/* $NetBSD: athn.c,v 1.17 2017/10/23 09:25:11 msaitoh Exp $ */
/* $OpenBSD: athn.c,v 1.83 2014/07/22 13:12:11 mpi Exp $ */
/*-
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: athn.c,v 1.16 2017/04/11 17:27:54 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: athn.c,v 1.17 2017/10/23 09:25:11 msaitoh Exp $");
#ifndef _MODULE
#include "athn_usb.h" /* for NATHN_USB */
@@ -349,7 +349,16 @@ athn_attach(struct athn_softc *sc)
IFQ_SET_READY(&ifp->if_snd);
memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
- if_initialize(ifp);
+ error = if_initialize(ifp);
+ if (error != 0) {
+ aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
+ error);
+ pmf_event_deregister(sc->sc_dev, PMFE_RADIO_OFF,
+ athn_pmf_wlan_off, false);
+ callout_destroy(&sc->sc_scan_to);
+ callout_destroy(&sc->sc_calib_to);
+ return error;
+ }
ieee80211_ifattach(ic);
/* Use common softint-based if_input */
ifp->if_percpuq = if_percpuq_create(ifp);
@@ -412,6 +421,9 @@ athn_detach(struct athn_softc *sc)
callout_destroy(&sc->sc_scan_to);
callout_destroy(&sc->sc_calib_to);
+
+ pmf_event_deregister(sc->sc_dev, PMFE_RADIO_OFF, athn_pmf_wlan_off,
+ false);
}
/*