Cleanup the error handling code introduced in rev. 1.26. Commented by jhawk.
No functional change.
This commit is contained in:
parent
7eb72c4f15
commit
8b74873d54
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ucom.c,v 1.27 2000/09/10 03:10:20 toshii Exp $ */
|
||||
/* $NetBSD: ucom.c,v 1.28 2000/09/13 05:17:14 toshii Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
|
||||
@ -367,6 +367,7 @@ ucomopen(dev_t dev, int flag, int mode, struct proc *p)
|
||||
DPRINTF(("%s: open bulk out error (addr %d), err=%s\n",
|
||||
USBDEVNAME(sc->sc_dev), sc->sc_bulkin_no,
|
||||
usbd_errstr(err)));
|
||||
error = EIO;
|
||||
goto fail_0;
|
||||
}
|
||||
err = usbd_open_pipe(sc->sc_iface, sc->sc_bulkout_no,
|
||||
@ -375,28 +376,37 @@ ucomopen(dev_t dev, int flag, int mode, struct proc *p)
|
||||
DPRINTF(("%s: open bulk in error (addr %d), err=%s\n",
|
||||
USBDEVNAME(sc->sc_dev), sc->sc_bulkout_no,
|
||||
usbd_errstr(err)));
|
||||
error = EIO;
|
||||
goto fail_1;
|
||||
}
|
||||
|
||||
/* Allocate a request and an input buffer and start reading. */
|
||||
sc->sc_ixfer = usbd_alloc_xfer(sc->sc_udev);
|
||||
if (sc->sc_ixfer == NULL)
|
||||
if (sc->sc_ixfer == NULL) {
|
||||
error = ENOMEM;
|
||||
goto fail_2;
|
||||
}
|
||||
|
||||
sc->sc_ibuf = usbd_alloc_buffer(sc->sc_ixfer,
|
||||
sc->sc_ibufsizepad);
|
||||
if (sc->sc_ibuf == NULL)
|
||||
if (sc->sc_ibuf == NULL) {
|
||||
error = ENOMEM;
|
||||
goto fail_3;
|
||||
}
|
||||
|
||||
sc->sc_oxfer = usbd_alloc_xfer(sc->sc_udev);
|
||||
if (sc->sc_oxfer == NULL)
|
||||
if (sc->sc_oxfer == NULL) {
|
||||
error = ENOMEM;
|
||||
goto fail_3;
|
||||
}
|
||||
|
||||
sc->sc_obuf = usbd_alloc_buffer(sc->sc_oxfer,
|
||||
sc->sc_obufsize +
|
||||
sc->sc_opkthdrlen);
|
||||
if (sc->sc_obuf == NULL)
|
||||
if (sc->sc_obuf == NULL) {
|
||||
error = ENOMEM;
|
||||
goto fail_4;
|
||||
}
|
||||
|
||||
ucomstartread(sc);
|
||||
}
|
||||
@ -419,20 +429,14 @@ fail_4:
|
||||
fail_3:
|
||||
usbd_free_xfer(sc->sc_ixfer);
|
||||
fail_2:
|
||||
usbd_close_pipe(sc->sc_bulkin_pipe);
|
||||
usbd_close_pipe(sc->sc_bulkout_pipe);
|
||||
sc->sc_opening = 0;
|
||||
wakeup(&sc->sc_opening);
|
||||
splx(s);
|
||||
return (ENOMEM);
|
||||
|
||||
fail_1:
|
||||
usbd_close_pipe(sc->sc_bulkin_pipe);
|
||||
fail_0:
|
||||
sc->sc_opening = 0;
|
||||
wakeup(&sc->sc_opening);
|
||||
splx(s);
|
||||
return (EIO);
|
||||
return (error);
|
||||
|
||||
bad:
|
||||
if (!ISSET(tp->t_state, TS_ISOPEN) && tp->t_wopen == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user