From owner-svn-src-all@FreeBSD.ORG Sun Mar 15 20:20:44 2015 Return-Path: Delivered-To: svn-src-all@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 42C4CC0B; Sun, 15 Mar 2015 20:20:44 +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 2E877EC6; Sun, 15 Mar 2015 20:20:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2FKKi2I055868; Sun, 15 Mar 2015 20:20:44 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2FKKi7e055867; Sun, 15 Mar 2015 20:20:44 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201503152020.t2FKKi7e055867@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 20:20:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280060 - 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-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Mar 2015 20:20:44 -0000 Author: adrian Date: Sun Mar 15 20:20:43 2015 New Revision: 280060 URL: https://svnweb.freebsd.org/changeset/base/280060 Log: Fix error handling in wpi_scan(). 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 20:19:54 2015 (r280059) +++ head/sys/dev/wpi/if_wpi.c Sun Mar 15 20:20:43 2015 (r280060) @@ -3600,6 +3600,9 @@ wpi_scan(struct wpi_softc *sc, struct ie if (sc->sc_scan_timer) { device_printf(sc->sc_dev, "%s: called whilst scanning!\n", __func__); + + DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END_ERR, __func__); + return (EAGAIN); } @@ -3608,7 +3611,8 @@ wpi_scan(struct wpi_softc *sc, struct ie device_printf(sc->sc_dev, "%s: could not allocate buffer for scan command\n", __func__); - return ENOMEM; + error = ENOMEM; + goto fail; } hdr = (struct wpi_scan_hdr *)buf; @@ -3733,10 +3737,17 @@ wpi_scan(struct wpi_softc *sc, struct ie error = wpi_cmd(sc, WPI_CMD_SCAN, buf, buflen, 1); free(buf, M_DEVBUF); + if (error != 0) + goto fail; + sc->sc_scan_timer = 5; DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__); + return 0; + +fail: DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END_ERR, __func__); + return error; }