From owner-svn-src-head@FreeBSD.ORG Wed May 27 22:29:20 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 403E449E; Wed, 27 May 2015 22:29:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E5F7CFD; Wed, 27 May 2015 22:29:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4RMTKD9075828; Wed, 27 May 2015 22:29:20 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4RMTKR3075827; Wed, 27 May 2015 22:29:20 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201505272229.t4RMTKR3075827@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 27 May 2015 22:29:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283638 - head/sys/dev/bwi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2015 22:29:20 -0000 Author: glebius Date: Wed May 27 22:29:19 2015 New Revision: 283638 URL: https://svnweb.freebsd.org/changeset/base/283638 Log: In bwi_mac_fw_alloc(): - Use device_printf() instead of if_printf(). - Reduce cut and paste. Modified: head/sys/dev/bwi/bwimac.c Modified: head/sys/dev/bwi/bwimac.c ============================================================================== --- head/sys/dev/bwi/bwimac.c Wed May 27 22:27:15 2015 (r283637) +++ head/sys/dev/bwi/bwimac.c Wed May 27 22:29:19 2015 (r283638) @@ -883,7 +883,6 @@ static int bwi_mac_fw_alloc(struct bwi_mac *mac) { struct bwi_softc *sc = mac->mac_sc; - struct ifnet *ifp = sc->sc_ifp; char fwname[64]; int idx; @@ -895,10 +894,8 @@ bwi_mac_fw_alloc(struct bwi_mac *mac) snprintf(fwname, sizeof(fwname), BWI_FW_STUB_PATH, sc->sc_fw_version); mac->mac_stub = firmware_get(fwname); - if (mac->mac_stub == NULL) { - if_printf(ifp, "request firmware %s failed\n", fwname); - return ENOMEM; - } + if (mac->mac_stub == NULL) + goto no_firmware; } if (mac->mac_ucode == NULL) { @@ -907,11 +904,8 @@ bwi_mac_fw_alloc(struct bwi_mac *mac) mac->mac_rev >= 5 ? 5 : mac->mac_rev); mac->mac_ucode = firmware_get(fwname); - if (mac->mac_ucode == NULL) { - if_printf(ifp, "request firmware %s failed\n", fwname); - return ENOMEM; - } - + if (mac->mac_ucode == NULL) + goto no_firmware; if (!bwi_fwimage_is_valid(sc, mac->mac_ucode, BWI_FW_T_UCODE)) return EINVAL; } @@ -922,11 +916,8 @@ bwi_mac_fw_alloc(struct bwi_mac *mac) mac->mac_rev < 5 ? 4 : 5); mac->mac_pcm = firmware_get(fwname); - if (mac->mac_pcm == NULL) { - if_printf(ifp, "request firmware %s failed\n", fwname); - return ENOMEM; - } - + if (mac->mac_pcm == NULL) + goto no_firmware; if (!bwi_fwimage_is_valid(sc, mac->mac_pcm, BWI_FW_T_PCM)) return EINVAL; } @@ -938,8 +929,8 @@ bwi_mac_fw_alloc(struct bwi_mac *mac) } else if (mac->mac_rev >= 5 && mac->mac_rev <= 10) { idx = 5; } else { - if_printf(ifp, "no suitible IV for MAC rev %d\n", - mac->mac_rev); + device_printf(sc->sc_dev, + "no suitible IV for MAC rev %d\n", mac->mac_rev); return ENODEV; } @@ -947,10 +938,8 @@ bwi_mac_fw_alloc(struct bwi_mac *mac) sc->sc_fw_version, idx); mac->mac_iv = firmware_get(fwname); - if (mac->mac_iv == NULL) { - if_printf(ifp, "request firmware %s failed\n", fwname); - return ENOMEM; - } + if (mac->mac_iv == NULL) + goto no_firmware; if (!bwi_fwimage_is_valid(sc, mac->mac_iv, BWI_FW_T_IV)) return EINVAL; } @@ -960,12 +949,12 @@ bwi_mac_fw_alloc(struct bwi_mac *mac) if (mac->mac_rev == 2 || mac->mac_rev == 4 || mac->mac_rev >= 11) { /* No extended IV */ - goto back; + return (0); } else if (mac->mac_rev >= 5 && mac->mac_rev <= 10) { idx = 5; } else { - if_printf(ifp, "no suitible ExtIV for MAC rev %d\n", - mac->mac_rev); + device_printf(sc->sc_dev, + "no suitible ExtIV for MAC rev %d\n", mac->mac_rev); return ENODEV; } @@ -973,15 +962,16 @@ bwi_mac_fw_alloc(struct bwi_mac *mac) sc->sc_fw_version, idx); mac->mac_iv_ext = firmware_get(fwname); - if (mac->mac_iv_ext == NULL) { - if_printf(ifp, "request firmware %s failed\n", fwname); - return ENOMEM; - } + if (mac->mac_iv_ext == NULL) + goto no_firmware; if (!bwi_fwimage_is_valid(sc, mac->mac_iv_ext, BWI_FW_T_IV)) return EINVAL; } -back: - return 0; + return (0); + +no_firmware: + device_printf(sc->sc_dev, "request firmware %s failed\n", fwname); + return (ENOENT); } static void