Module Name: src
Committed By: msaitoh
Date: Mon Oct 23 09:25:11 UTC 2017
Modified Files:
src/sys/dev/ic: athn.c
Log Message:
- If if_initialize() failed in athn_attach(), free resources and return.
- Add missing pmf_event_deregister() in athn_detach().
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/athn.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/ic/athn.c
diff -u src/sys/dev/ic/athn.c:1.16 src/sys/dev/ic/athn.c:1.17
--- src/sys/dev/ic/athn.c:1.16 Tue Apr 11 17:27:54 2017
+++ src/sys/dev/ic/athn.c Mon Oct 23 09:25:11 2017
@@ -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);
}
/*