Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=195af2cce5ff81c4609c7ba585b6698a7771cbfc
Commit:     195af2cce5ff81c4609c7ba585b6698a7771cbfc
Parent:     69d42a78f935d19384d1f6e4f94b65bb162b36df
Author:     Alan Stern <[EMAIL PROTECTED]>
AuthorDate: Mon Jul 16 15:28:19 2007 -0400
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Thu Jul 19 17:46:04 2007 -0700

    USB: fix warning caused by autosuspend counter going negative
    
    This patch (as937) fixes a minor bug in the autosuspend usage-counting
    code.  Each hub's usage counter keeps track of the number of
    unsuspended children.  However the current driver increments the
    counter after registering a new child, by which time the child may
    already have been suspended and caused the counter to go negative.
    The obvious solution is to increment the counter before registering
    the child.
    
    Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
    Cc: stable <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/usb/core/hub.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index fd74c50..e341a1d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1335,6 +1335,10 @@ int usb_new_device(struct usb_device *udev)
        udev->dev.devt = MKDEV(USB_DEVICE_MAJOR,
                        (((udev->bus->busnum-1) * 128) + (udev->devnum-1)));
 
+       /* Increment the parent's count of unsuspended children */
+       if (udev->parent)
+               usb_autoresume_device(udev->parent);
+
        /* Register the device.  The device driver is responsible
         * for adding the device files to sysfs and for configuring
         * the device.
@@ -1342,13 +1346,11 @@ int usb_new_device(struct usb_device *udev)
        err = device_add(&udev->dev);
        if (err) {
                dev_err(&udev->dev, "can't device_add, error %d\n", err);
+               if (udev->parent)
+                       usb_autosuspend_device(udev->parent);
                goto fail;
        }
 
-       /* Increment the parent's count of unsuspended children */
-       if (udev->parent)
-               usb_autoresume_device(udev->parent);
-
 exit:
        return err;
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to