diff options
| author | Nick Hibma <n_hibma@FreeBSD.org> | 2001-08-30 21:45:28 +0000 |
|---|---|---|
| committer | Nick Hibma <n_hibma@FreeBSD.org> | 2001-08-30 21:45:28 +0000 |
| commit | f3dfa83f4fa1287253871c6448a027caa952daf8 (patch) | |
| tree | a1db9e07c384cdbd635e1c7e3238c5d550f80368 /sys/dev | |
| parent | a102b12e67d5b0a778fe841087a316207e10df45 (diff) | |
Notes
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/usb/ugen.c | 43 |
1 files changed, 10 insertions, 33 deletions
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index b76465dbcea3..7a10e45503df 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -554,7 +554,7 @@ ugenclose(dev_t dev, int flag, int mode, struct proc *p) Static int ugen_do_read(struct ugen_softc *sc, int endpt, struct uio *uio, int flag) { - struct ugen_endpoint *sce = &sc->sc_endpoints[endpt][IN]; + struct ugen_endpoint *sce; u_int32_t n, tn; char buf[UGEN_BBSIZE]; usbd_xfer_handle xfer; @@ -571,16 +571,9 @@ ugen_do_read(struct ugen_softc *sc, int endpt, struct uio *uio, int flag) if (endpt == USB_CONTROL_ENDPOINT) return (ENODEV); -#ifdef DIAGNOSTIC - if (sce->edesc == NULL) { - printf("ugenread: no edesc\n"); - return (EIO); - } - if (sce->pipeh == NULL) { - printf("ugenread: no pipe\n"); - return (EIO); - } -#endif + sce = &sc->sc_endpoints[endpt][IN]; + if (sce == NULL || sce->edesc == NULL || sce->pipeh == NULL) + return (EINVAL); switch (sce->edesc->bmAttributes & UE_XFERTYPE) { case UE_INTERRUPT: @@ -712,7 +705,7 @@ ugenread(dev_t dev, struct uio *uio, int flag) Static int ugen_do_write(struct ugen_softc *sc, int endpt, struct uio *uio, int flag) { - struct ugen_endpoint *sce = &sc->sc_endpoints[endpt][OUT]; + struct ugen_endpoint *sce; u_int32_t n; int error = 0; char buf[UGEN_BBSIZE]; @@ -727,16 +720,9 @@ ugen_do_write(struct ugen_softc *sc, int endpt, struct uio *uio, int flag) if (endpt == USB_CONTROL_ENDPOINT) return (ENODEV); -#ifdef DIAGNOSTIC - if (sce->edesc == NULL) { - printf("ugen_do_write: no edesc\n"); - return (EIO); - } - if (sce->pipeh == NULL) { - printf("ugen_do_write: no pipe\n"); - return (EIO); - } -#endif + sce = &sc->sc_endpoints[endpt][OUT]; + if (sce == NULL || sce->edesc == NULL || sce->pipeh == NULL) + return (EINVAL); switch (sce->edesc->bmAttributes & UE_XFERTYPE) { case UE_BULK: @@ -1353,18 +1339,9 @@ ugenpoll(dev_t dev, int events, struct proc *p) /* XXX always IN */ sce = &sc->sc_endpoints[UGENENDPOINT(dev)][IN]; - if (sce == NULL) + if (sce == NULL || sce->edesc == NULL || sce->pipeh == NULL) return (EINVAL); -#ifdef DIAGNOSTIC - if (!sce->edesc) { - printf("ugenpoll: no edesc\n"); - return (EIO); - } - if (!sce->pipeh) { - printf("ugenpoll: no pipe\n"); - return (EIO); - } -#endif + s = splusb(); switch (sce->edesc->bmAttributes & UE_XFERTYPE) { case UE_INTERRUPT: |
