Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Mar 2015 20:20:44 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r280060 - head/sys/dev/wpi
Message-ID:  <201503152020.t2FKKi7e055867@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <s3erios@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 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;
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201503152020.t2FKKi7e055867>