From 0417ded58b5801a27ed0c590542000507ec3d080 Mon Sep 17 00:00:00 2001 From: stsp Date: Sun, 20 Jul 2014 11:56:15 +0000 Subject: [PATCH] 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 --- sys/dev/ic/bwi.c | 15 +++++++++------ 1 file 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) { -- 2.20.1