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

Reply via email to