Author: thompsa
Date: Sat Nov 27 19:37:33 2010
New Revision: 215945
URL: http://svn.freebsd.org/changeset/base/215945

Log:
  MFC r213425
  
   The root mount hold reference was not released on USB controller
   attach failures during boot.

Modified:
  stable/8/sys/dev/usb/controller/usb_controller.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/mips/alchemy/   (props changed)
  stable/8/sys/mips/atheros/   (props changed)
  stable/8/sys/mips/cavium/   (props changed)
  stable/8/sys/mips/cavium/dev/   (props changed)
  stable/8/sys/mips/rmi/   (props changed)
  stable/8/sys/mips/rmi/dev/   (props changed)
  stable/8/sys/mips/sibyte/   (props changed)

Modified: stable/8/sys/dev/usb/controller/usb_controller.c
==============================================================================
--- stable/8/sys/dev/usb/controller/usb_controller.c    Sat Nov 27 19:35:12 
2010        (r215944)
+++ stable/8/sys/dev/usb/controller/usb_controller.c    Sat Nov 27 19:37:33 
2010        (r215945)
@@ -126,6 +126,16 @@ usb_probe(device_t dev)
        return (0);
 }
 
+static void
+usb_root_mount_rel(struct usb_bus *bus)
+{
+       if (bus->bus_roothold != NULL) {
+               DPRINTF("Releasing root mount hold %p\n", bus->bus_roothold);
+               root_mount_rel(bus->bus_roothold);
+               bus->bus_roothold = NULL;
+       }
+}
+
 /*------------------------------------------------------------------------*
  *     usb_attach
  *------------------------------------------------------------------------*/
@@ -169,10 +179,7 @@ usb_detach(device_t dev)
        usb_callout_drain(&bus->power_wdog);
 
        /* Let the USB explore process detach all devices. */
-       if (bus->bus_roothold != NULL) {
-               root_mount_rel(bus->bus_roothold);
-               bus->bus_roothold = NULL;
-       }
+       usb_root_mount_rel(bus);
 
        USB_BUS_LOCK(bus);
        if (usb_proc_msignal(&bus->explore_proc,
@@ -249,10 +256,7 @@ usb_bus_explore(struct usb_proc_msg *pm)
                (udev->hub->explore) (udev);
                USB_BUS_LOCK(bus);
        }
-       if (bus->bus_roothold != NULL) {
-               root_mount_rel(bus->bus_roothold);
-               bus->bus_roothold = NULL;
-       }
+       usb_root_mount_rel(bus);
 }
 
 /*------------------------------------------------------------------------*
@@ -363,6 +367,7 @@ usb_bus_attach(struct usb_proc_msg *pm)
 
        default:
                device_printf(bus->bdev, "Unsupported USB revision\n");
+               usb_root_mount_rel(bus);
                return;
        }
 
@@ -404,6 +409,7 @@ usb_bus_attach(struct usb_proc_msg *pm)
        if (err) {
                device_printf(bus->bdev, "Root HUB problem, error=%s\n",
                    usbd_errstr(err));
+               usb_root_mount_rel(bus);
        }
 
        /* set softc - we are ready */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to