summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2014-07-20 11:56:16 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2014-07-20 11:56:16 +0000
commitd85111f7c1a6b21cc19132628f88ca370f878b8f (patch)
tree8634aaf544b35727477d8aee259cf796eb820358
parent3f4471f875a224689142ba97487c560906d26973 (diff)
Load bwi(4) firmware once, not every time the interface is brought up.
Fixes a panic if the interrupt handler decides to reset the device. Firmware cannot be loaded in interrupt context. ok mpi@ as part of a larger diff
-rw-r--r--sys/dev/ic/bwi.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/dev/ic/bwi.c b/sys/dev/ic/bwi.c
index 33a9b4eda11..0313a759b0c 100644
--- a/sys/dev/ic/bwi.c
+++ b/sys/dev/ic/bwi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bwi.c,v 1.102 2014/07/12 18:48:17 tedu Exp $ */
+/* $OpenBSD: bwi.c,v 1.103 2014/07/20 11:56:15 stsp Exp $ */
/*
* Copyright (c) 2007 The DragonFly Project. All rights reserved.
@@ -1720,11 +1720,14 @@ bwi_mac_fw_alloc(struct bwi_mac *mac)
char fwname[64];
int idx, error;
- error = loadfirmware(name, &mac->mac_fw, &mac->mac_fw_size);
- if (error != 0) {
- printf("%s: error %d, could not read firmware %s\n",
- sc->sc_dev.dv_xname, error, name);
- return (EIO);
+ if (mac->mac_fw == NULL) {
+ error = loadfirmware(name, &mac->mac_fw, &mac->mac_fw_size);
+ if (error != 0) {
+ printf("%s: error %d, could not read firmware %s\n",
+ sc->sc_dev.dv_xname, error, name);
+ mac->mac_fw = NULL;
+ return (EIO);
+ }
}
if (mac->mac_ucode == NULL) {