From owner-svn-src-head@freebsd.org Sat Mar 25 22:07:23 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08A21D1DEFD; Sat, 25 Mar 2017 22:07:23 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 CC541163; Sat, 25 Mar 2017 22:07:22 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2PM7Lv2010244; Sat, 25 Mar 2017 22:07:21 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2PM7L4Z010243; Sat, 25 Mar 2017 22:07:21 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201703252207.v2PM7L4Z010243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sat, 25 Mar 2017 22:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315966 - head/sys/dev/iwn 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.23 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: Sat, 25 Mar 2017 22:07:23 -0000 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