From owner-svn-src-head@FreeBSD.ORG Sun Mar 15 21:12:58 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 97865E9; Sun, 15 Mar 2015 21:12:58 +0000 (UTC) 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 6A2C885B; Sun, 15 Mar 2015 21:12:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2FLCwBe084902; Sun, 15 Mar 2015 21:12:58 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2FLCwr9084901; Sun, 15 Mar 2015 21:12:58 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201503152112.t2FLCwr9084901@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 15 Mar 2015 21:12:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280102 - head/sys/dev/wpi 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.18-1 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: Sun, 15 Mar 2015 21:12:58 -0000 Author: adrian Date: Sun Mar 15 21:12:57 2015 New Revision: 280102 URL: https://svnweb.freebsd.org/changeset/base/280102 Log: Rearrange checks in wpi_send_rxon(). PR: kern/197143 Submitted by: Andriy Voskoboinyk Modified: head/sys/dev/wpi/if_wpi.c Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Sun Mar 15 21:12:05 2015 (r280101) +++ head/sys/dev/wpi/if_wpi.c Sun Mar 15 21:12:57 2015 (r280102) @@ -3648,32 +3648,32 @@ wpi_send_rxon(struct wpi_softc *sc, int error = wpi_cmd(sc, WPI_CMD_RXON_ASSOC, &rxon_assoc, sizeof (struct wpi_assoc), async); + if (error != 0) { + device_printf(sc->sc_dev, + "RXON_ASSOC command failed, error %d\n", error); + return error; + } } else { - if (async) + if (async) { WPI_NT_LOCK(sc); - - error = wpi_cmd(sc, WPI_CMD_RXON, &sc->rxon, - sizeof (struct wpi_rxon), async); - - wpi_clear_node_table(sc); - - if (async) + error = wpi_cmd(sc, WPI_CMD_RXON, &sc->rxon, + sizeof (struct wpi_rxon), async); + if (error == 0) + wpi_clear_node_table(sc); WPI_NT_UNLOCK(sc); - } - if (error != 0) { - device_printf(sc->sc_dev, "RXON command failed, error %d\n", - error); - return error; - } + } else { + error = wpi_cmd(sc, WPI_CMD_RXON, &sc->rxon, + sizeof (struct wpi_rxon), async); + if (error == 0) + wpi_clear_node_table(sc); + } - /* Configuration has changed, set Tx power accordingly. */ - if ((error = wpi_set_txpower(sc, async)) != 0) { - device_printf(sc->sc_dev, - "%s: could not set TX power, error %d\n", __func__, error); - return error; - } + if (error != 0) { + device_printf(sc->sc_dev, + "RXON command failed, error %d\n", error); + return error; + } - if (!(sc->rxon.filter & htole32(WPI_FILTER_BSS))) { /* Add broadcast node. */ error = wpi_add_broadcast_node(sc, async); if (error != 0) { @@ -3683,6 +3683,13 @@ wpi_send_rxon(struct wpi_softc *sc, int } } + /* Configuration has changed, set Tx power accordingly. */ + if ((error = wpi_set_txpower(sc, async)) != 0) { + device_printf(sc->sc_dev, + "%s: could not set TX power, error %d\n", __func__, error); + return error; + } + return 0; }