Author: avos
Date: Sat Mar 25 22:07:21 2017
New Revision: 315966
URL: https://svnweb.freebsd.org/changeset/base/315966

Log:
  iwn: fix return code conflict in iwn_init_locked()
  
  Do not try to use errno(2) codes here; instead, just return unique
  value (1) when radio is disabled via hardware switch and another
  one (-1) for any other error in initialization path.
  
  Tested with Intel 6205, STA mode.

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==============================================================================
--- head/sys/dev/iwn/if_iwn.c   Sat Mar 25 21:46:02 2017        (r315965)
+++ head/sys/dev/iwn/if_iwn.c   Sat Mar 25 22:07:21 2017        (r315966)
@@ -5120,7 +5120,7 @@ iwn_parent(struct ieee80211com *ic)
                case 0:
                        ieee80211_start_all(ic);
                        break;
-               case EAGAIN:
+               case 1:
                        /* radio is disabled via RFkill switch */
                        taskqueue_enqueue(sc->sc_tq, &sc->sc_rftoggle_task);
                        break;
@@ -8879,8 +8879,10 @@ iwn_init_locked(struct iwn_softc *sc)
 
        /* Check that the radio is not disabled by hardware switch. */
        if (!(IWN_READ(sc, IWN_GP_CNTRL) & IWN_GP_CNTRL_RFKILL)) {
-               error = EAGAIN;
-               goto fail;
+               iwn_stop_locked(sc);
+               DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
+
+               return (1);
        }
 
        /* Read firmware images from the filesystem. */
@@ -8921,7 +8923,7 @@ fail:
 
        DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end in error\n",__func__);
 
-       return (error);
+       return (-1);
 }
 
 static int
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to