Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic - If if_initialize() failed in athn_attach(), fre...
details: https://anonhg.NetBSD.org/src/rev/e382d82fee19
branches: trunk
changeset: 827309:e382d82fee19
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Mon Oct 23 09:25:11 2017 +0000
description:
- If if_initialize() failed in athn_attach(), free resources and return.
- Add missing pmf_event_deregister() in athn_detach().
diffstat:
sys/dev/ic/athn.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diffs (46 lines):
diff -r 241a22782651 -r e382d82fee19 sys/dev/ic/athn.c
--- a/sys/dev/ic/athn.c Mon Oct 23 09:24:34 2017 +0000
+++ b/sys/dev/ic/athn.c Mon Oct 23 09:25:11 2017 +0000
@@ -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 @@
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 @@
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);
}
/*
Home |
Main Index |
Thread Index |
Old Index