Module Name: src Committed By: martin Date: Sun Aug 12 18:55:11 UTC 2012
Modified Files: src/sys/dev/pci [netbsd-6]: if_wpi.c Log Message: Pull up following revision(s) (requested by riastradh in ticket #478): sys/dev/pci/if_wpi.c: revision 1.53 Fix error branch in wpi(4) firmware loading. Fixes panic if firmware is not available. To generate a diff of this commit: cvs rdiff -u -r1.50.2.2 -r1.50.2.3 src/sys/dev/pci/if_wpi.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/pci/if_wpi.c diff -u src/sys/dev/pci/if_wpi.c:1.50.2.2 src/sys/dev/pci/if_wpi.c:1.50.2.3 --- src/sys/dev/pci/if_wpi.c:1.50.2.2 Tue May 22 18:36:33 2012 +++ src/sys/dev/pci/if_wpi.c Sun Aug 12 18:55:10 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wpi.c,v 1.50.2.2 2012/05/22 18:36:33 riz Exp $ */ +/* $NetBSD: if_wpi.c,v 1.50.2.3 2012/08/12 18:55:10 martin Exp $ */ /*- * Copyright (c) 2006, 2007 @@ -18,7 +18,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.50.2.2 2012/05/22 18:36:33 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.50.2.3 2012/08/12 18:55:10 martin Exp $"); /* * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters. @@ -1148,7 +1148,7 @@ wpi_cache_firmware(struct wpi_softc *sc) /* load firmware image from disk */ if ((error = firmware_open("if_wpi","iwlwifi-3945.ucode", &fw)) != 0) { aprint_error_dev(sc->sc_dev, "could not read firmware file\n"); - goto fail1; + goto fail0; } wpi_firmware_size = firmware_get_size(fw); @@ -1192,8 +1192,9 @@ fail2: firmware_free(wpi_firmware_image, wpi_firmware_size); fail1: firmware_close(fw); - if (--wpi_firmware_users == 0) - firmware_free(wpi_firmware_image, wpi_firmware_size); +fail0: + wpi_firmware_users--; + KASSERT(wpi_firmware_users == 0); mutex_exit(&wpi_firmware_mutex); return error; }