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 <s3er...@gmail.com>

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;
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to