Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Replace USB_GET_SC() instances with USB_GET_SC_O...



details:   https://anonhg.NetBSD.org/src/rev/32cec4e5ed32
branches:  trunk
changeset: 752201:32cec4e5ed32
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Feb 19 12:40:47 2010 +0000

description:
Replace USB_GET_SC() instances with USB_GET_SC_OPEN().  The latter
is exactly like the former, except it returns with ENXIO if sc is
NULL instead of continuing on to use it.  Most of the time this is
handled by the fd layer and you get EBADF, but sometimes it's
possible to race into the device method for whatever reason and
you get a kernel panic.  I have no idea what the "whatever reason"
might be.

diffstat:

 sys/dev/usb/ugen.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (72 lines):

diff -r eb68f795b644 -r 32cec4e5ed32 sys/dev/usb/ugen.c
--- a/sys/dev/usb/ugen.c        Fri Feb 19 12:36:15 2010 +0000
+++ b/sys/dev/usb/ugen.c        Fri Feb 19 12:40:47 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ugen.c,v 1.108 2009/12/24 01:32:22 jakllsch Exp $      */
+/*     $NetBSD: ugen.c,v 1.109 2010/02/19 12:40:47 pooka Exp $ */
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.108 2009/12/24 01:32:22 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.109 2010/02/19 12:40:47 pooka Exp $");
 
 #include "opt_compat_netbsd.h"
 
@@ -507,7 +507,7 @@
        int dir;
        int i;
 
-       USB_GET_SC(ugen, UGENUNIT(dev), sc);
+       USB_GET_SC_OPEN(ugen, UGENUNIT(dev), sc);
 
        DPRINTFN(5, ("ugenclose: flag=%d, mode=%d, unit=%d, endpt=%d\n",
                     flag, mode, UGENUNIT(dev), endpt));
@@ -786,7 +786,7 @@
        struct ugen_softc *sc;
        int error;
 
-       USB_GET_SC(ugen, UGENUNIT(dev), sc);
+       USB_GET_SC_OPEN(ugen, UGENUNIT(dev), sc);
 
        sc->sc_refcnt++;
        error = ugen_do_read(sc, endpt, uio, flag);
@@ -969,7 +969,7 @@
        struct ugen_softc *sc;
        int error;
 
-       USB_GET_SC(ugen, UGENUNIT(dev), sc);
+       USB_GET_SC_OPEN(ugen, UGENUNIT(dev), sc);
 
        sc->sc_refcnt++;
        error = ugen_do_write(sc, endpt, uio, flag);
@@ -1823,7 +1823,7 @@
        struct ugen_softc *sc;
        int error;
 
-       USB_GET_SC(ugen, UGENUNIT(dev), sc);
+       USB_GET_SC_OPEN(ugen, UGENUNIT(dev), sc);
 
        sc->sc_refcnt++;
        error = ugen_do_ioctl(sc, endpt, cmd, addr, flag, l);
@@ -1840,7 +1840,7 @@
        int revents = 0;
        int s;
 
-       USB_GET_SC(ugen, UGENUNIT(dev), sc);
+       USB_GET_SC_OPEN(ugen, UGENUNIT(dev), sc);
 
        if (sc->sc_dying)
                return (POLLHUP);
@@ -2025,7 +2025,7 @@
        struct klist *klist;
        int s;
 
-       USB_GET_SC(ugen, UGENUNIT(dev), sc);
+       USB_GET_SC_OPEN(ugen, UGENUNIT(dev), sc);
 
        if (sc->sc_dying)
                return (ENXIO);



Home | Main Index | Thread Index | Old Index