summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2002-07-09 01:01:25 +0000
committerjoe <joe@FreeBSD.org>2002-07-09 01:01:25 +0000
commit48d5c9ed0e44969508ef8add6c8337a8fce7f513 (patch)
treedc8f9f642008cd149d0bc32bd2c5a18e587e1739
parent6625a99a43044348b09bcb8fa1094f017badfde3 (diff)
downloadFreeBSD-src-48d5c9ed0e44969508ef8add6c8337a8fce7f513.zip
FreeBSD-src-48d5c9ed0e44969508ef8add6c8337a8fce7f513.tar.gz
Delay the creation of the ugenX device node until we're certain
that the attach succeeded. (Fixes a potential panic for devices that fail to attach properly and are subsquently unplugged and then plugged back in again.)
-rw-r--r--sys/dev/usb/ugen.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c
index 3e3327d..3b1dcb5 100644
--- a/sys/dev/usb/ugen.c
+++ b/sys/dev/usb/ugen.c
@@ -205,11 +205,6 @@ USB_ATTACH(ugen)
sc->sc_udev = udev = uaa->device;
-#if defined(__FreeBSD__)
- /* the main device, ctrl endpoint */
- make_dev(&ugen_cdevsw, UGENMINOR(USBDEVUNIT(sc->sc_dev), 0),
- UID_ROOT, GID_OPERATOR, 0644, "%s", USBDEVNAME(sc->sc_dev));
-#endif
memset(sc->sc_endpoints, 0, sizeof sc->sc_endpoints);
/* First set configuration index 0, the default one for ugen. */
@@ -231,6 +226,12 @@ USB_ATTACH(ugen)
USB_ATTACH_ERROR_RETURN;
}
+#if defined(__FreeBSD__)
+ /* the main device, ctrl endpoint */
+ make_dev(&ugen_cdevsw, UGENMINOR(USBDEVUNIT(sc->sc_dev), 0),
+ UID_ROOT, GID_OPERATOR, 0644, "%s", USBDEVNAME(sc->sc_dev));
+#endif
+
USB_ATTACH_SUCCESS_RETURN;
}
OpenPOWER on IntegriCloud