diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2004-11-03 17:10:04 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2004-11-03 17:10:04 +0000 |
commit | 8d13e73f5949fc0779106eb037e1f01960a1eee4 (patch) | |
tree | bd8d168c584bc1df746c81a1b1a62b71b7e18495 /sys/dev/pci/if_ipw.c | |
parent | c4134ff8866cb8044037a6ac0d94b42785819976 (diff) |
Calling ipwcontrol -k without downloading the firmware first lead to a
panic. Fix the ipw_free_firmware() function itself instead of fixing the
callers.
ok claudio@
Diffstat (limited to 'sys/dev/pci/if_ipw.c')
-rw-r--r-- | sys/dev/pci/if_ipw.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/pci/if_ipw.c b/sys/dev/pci/if_ipw.c index bdef2eb8646..b7ea76abab7 100644 --- a/sys/dev/pci/if_ipw.c +++ b/sys/dev/pci/if_ipw.c @@ -1,4 +1,4 @@ -/* $Id: if_ipw.c,v 1.20 2004/11/03 17:07:10 damien Exp $ */ +/* $Id: if_ipw.c,v 1.21 2004/11/03 17:10:03 damien Exp $ */ /*- * Copyright (c) 2004 @@ -305,9 +305,7 @@ ipw_detach(struct device* self, int flags) ipw_stop(ifp, 1); ipw_dmamem_stop(sc); - - if (sc->flags & IPW_FLAG_FW_CACHED) - ipw_free_firmware(sc); + ipw_free_firmware(sc); #if NBPFILTER > 0 bpfdetach(ifp); @@ -1748,8 +1746,7 @@ ipw_cache_firmware(struct ipw_softc *sc, void *data) u_char *p = data; int error; - if (sc->flags & IPW_FLAG_FW_CACHED) - ipw_free_firmware(sc); + ipw_free_firmware(sc); if ((error = copyin(data, &hdr, sizeof hdr)) != 0) goto fail1; @@ -1792,6 +1789,9 @@ fail1: return error; void ipw_free_firmware(struct ipw_softc *sc) { + if (!(sc->flags & IPW_FLAG_FW_CACHED)) + return; + free(sc->fw.main, M_DEVBUF); free(sc->fw.ucode, M_DEVBUF); |