diff options
author | Marc Balmer <mbalmer@cvs.openbsd.org> | 2007-06-11 12:36:54 +0000 |
---|---|---|
committer | Marc Balmer <mbalmer@cvs.openbsd.org> | 2007-06-11 12:36:54 +0000 |
commit | 6c2d41245ee67a282a457622925eb8223e42d4ad (patch) | |
tree | 7cd0224b4481980f6ecc742eaa16456e91b6ccf3 /sys | |
parent | 9f1e83adf5a46e00e53fe55de42cb2e82aafccce (diff) |
Remove the USB_GET_SC_OPEN macro. There is a double check for sc == NULL in
ulpt.c, I am aware of that and it will be changed later.
No binary change.
ok mk.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/ugen.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/uhid.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/ulpt.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/urio.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/usb.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/usb_port.h | 9 | ||||
-rw-r--r-- | sys/dev/usb/uscanner.c | 8 |
7 files changed, 37 insertions, 20 deletions
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 9845271716e..b57bb9aaa7f 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ugen.c,v 1.45 2007/06/11 10:58:21 mbalmer Exp $ */ +/* $OpenBSD: ugen.c,v 1.46 2007/06/11 12:36:52 mbalmer Exp $ */ /* $NetBSD: ugen.c,v 1.63 2002/11/26 18:49:48 christos Exp $ */ /* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -274,7 +274,11 @@ ugenopen(dev_t dev, int flag, int mode, usb_proc_ptr p) void *buf; int i, j; - USB_GET_SC_OPEN(ugen, unit, sc); + if (unit >= ugen_cd.cd_ndevs) + return (ENXIO); + sc = ugen_cd.cd_devs[unit]; + if (sc == NULL) + return (ENXIO); DPRINTFN(5, ("ugenopen: flag=%d, mode=%d, unit=%d endpt=%d\n", flag, mode, unit, endpt)); diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index 83c6406ea55..99b907aed38 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhid.c,v 1.37 2007/06/11 10:58:21 mbalmer Exp $ */ +/* $OpenBSD: uhid.c,v 1.38 2007/06/11 12:36:52 mbalmer Exp $ */ /* $NetBSD: uhid.c,v 1.57 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -238,7 +238,11 @@ uhidopen(dev_t dev, int flag, int mode, usb_proc_ptr p) struct uhid_softc *sc; int error; - USB_GET_SC_OPEN(uhid, UHIDUNIT(dev), sc); + if (UHIDUNIT(dev) >= uhid_cd.cd_ndevs) + return (ENXIO); + sc = uhid_cd.cd_devs[UHIDUNIT(dev)]; + if (sc == NULL) + return (ENXIO); DPRINTF(("uhidopen: sc=%p\n", sc)); diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index 6203454ca2c..b70896e4913 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ulpt.c,v 1.28 2007/06/11 10:58:21 mbalmer Exp $ */ +/* $OpenBSD: ulpt.c,v 1.29 2007/06/11 12:36:52 mbalmer Exp $ */ /* $NetBSD: ulpt.c,v 1.57 2003/01/05 10:19:42 scw Exp $ */ /* $FreeBSD: src/sys/dev/usb/ulpt.c,v 1.24 1999/11/17 22:33:44 n_hibma Exp $ */ @@ -422,7 +422,11 @@ ulptopen(dev_t dev, int flag, int mode, usb_proc_ptr p) usbd_status err; int spin, error; - USB_GET_SC_OPEN(ulpt, ULPTUNIT(dev), sc); + if (ULPTUNIT(dev) >= ulpt_cd.cd_ndevs) + return (ENXIO); + sc = ulpt_cd.cd_devs[ULPTUNIT(dev)]; + if (sc == NULL) + return (ENXIO); if (sc == NULL || sc->sc_iface == NULL || sc->sc_dying) return (ENXIO); diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index 7cb9fd00d62..21117ac6501 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: urio.c,v 1.28 2007/06/11 10:58:21 mbalmer Exp $ */ +/* $OpenBSD: urio.c,v 1.29 2007/06/11 12:36:52 mbalmer Exp $ */ /* $NetBSD: urio.c,v 1.15 2002/10/23 09:14:02 jdolecek Exp $ */ /* @@ -252,7 +252,11 @@ urioopen(dev_t dev, int flag, int mode, usb_proc_ptr p) struct urio_softc *sc; usbd_status err; - USB_GET_SC_OPEN(urio, URIOUNIT(dev), sc); + if (URIOUNIT(dev) >= urio_cd.cd_ndevs) + return (ENXIO); + sc = urio_cd.cd_devs[URIOUNIT(dev)]; + if (sc == NULL) + return (ENXIO); DPRINTFN(5, ("urioopen: flag=%d, mode=%d, unit=%d\n", flag, mode, URIOUNIT(dev))); diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 0b99e1b9e06..2d0e6385471 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb.c,v 1.50 2007/06/11 10:58:21 mbalmer Exp $ */ +/* $OpenBSD: usb.c,v 1.51 2007/06/11 12:36:52 mbalmer Exp $ */ /* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */ /* @@ -386,7 +386,11 @@ usbopen(dev_t dev, int flag, int mode, usb_proc_ptr p) return (0); } - USB_GET_SC_OPEN(usb, unit, sc); + if (unit >= usb_cd.cd_ndevs) + return (ENXIO); + sc = usb_cd.cd_devs[unit]; + if (sc == NULL) + return (ENXIO); if (sc->sc_dying) return (EIO); diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h index 7cac0b5d370..39839e1081b 100644 --- a/sys/dev/usb/usb_port.h +++ b/sys/dev/usb/usb_port.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_port.h,v 1.83 2007/06/11 10:58:21 mbalmer Exp $ */ +/* $OpenBSD: usb_port.h,v 1.84 2007/06/11 12:36:53 mbalmer Exp $ */ /* $NetBSD: usb_port.h,v 1.62 2003/02/15 18:33:30 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_port.h,v 1.21 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -109,11 +109,4 @@ const struct cfattach __CONCAT(dname,_ca) = { \ #define USB_DECLARE_DRIVER(dname) USB_DECLARE_DRIVER_CLASS(dname, DV_DULL) -#define USB_GET_SC_OPEN(dname, unit, sc) \ - if (unit >= __CONCAT(dname,_cd).cd_ndevs) \ - return (ENXIO); \ - sc = __CONCAT(dname,_cd).cd_devs[unit]; \ - if (sc == NULL) \ - return (ENXIO) - #endif /* _USB_PORT_H */ diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c index b25e040b53f..6e22ecdda4f 100644 --- a/sys/dev/usb/uscanner.c +++ b/sys/dev/usb/uscanner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uscanner.c,v 1.31 2007/06/11 10:58:21 mbalmer Exp $ */ +/* $OpenBSD: uscanner.c,v 1.32 2007/06/11 12:36:53 mbalmer Exp $ */ /* $NetBSD: uscanner.c,v 1.40 2003/01/27 00:32:44 wiz Exp $ */ /* @@ -330,7 +330,11 @@ uscanneropen(dev_t dev, int flag, int mode, usb_proc_ptr p) int unit = USCANNERUNIT(dev); usbd_status err; - USB_GET_SC_OPEN(uscanner, unit, sc); + if (unit >= uscanner_cd.cd_ndevs) + return (ENXIO); + sc = uscanner_cd.cd_devs[unit]; + if (sc == NULL) + return (ENXIO); DPRINTFN(5, ("uscanneropen: flag=%d, mode=%d, unit=%d\n", flag, mode, unit)); |