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.)
This commit is contained in:
Josef Karthauser 2002-07-09 01:01:25 +00:00
parent 7680e41ce2
commit 7db8d4d987
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=99628

View File

@ -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;
}