On Wed, Sep 24, 2003 at 10:01:21PM -0700, David Brownell wrote:
> Greg KH wrote:
> >On Wed, Sep 24, 2003 at 06:04:38PM -0700, David Brownell wrote:
> >
> >>>> /* Decrement the reference count, it'll auto free everything when */
> >>>> /* it hits 0 which could very well be now */
> >>>>+ /* FIXME the decrement in device_unregister() should suffice ... */
> >>>> usb_put_dev(dev);
> >>>
> >>>
> >>>Not true at all. We need that last put_dev, as we called usb_get_dev in
> >>>the top of usb_new_device().
> >>
> >>Then the fix should then be to remove both of those, yes?
> >>The comment doesn't imply that's the only thing to change... :)
> >
> >
> >Try it :) From what I recall, we have to increment the count at this
> >point, as we increment it and decrement it when we start talking to the
> >device (getting the config and stuff.) This is because when we submit a
> >urb, we increment the device's count.
Ok, I was wrong. I went and tried it, and have now added the following
patch to the tree.
Thanks for pointing this out and making me look at it again :)
greg k-h
diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c Thu Sep 25 10:59:51 2003
+++ b/drivers/usb/core/usb.c Thu Sep 25 10:59:51 2003
@@ -922,10 +922,6 @@
}
up(&dev->serialize);
device_unregister(&dev->dev);
-
- /* Decrement the reference count, it'll auto free everything when */
- /* it hits 0 which could very well be now */
- usb_put_dev(dev);
}
/**
@@ -1009,7 +1005,6 @@
dev->dev.driver = &usb_generic_driver;
dev->dev.bus = &usb_bus_type;
dev->dev.driver_data = &usb_generic_driver_data;
- usb_get_dev(dev);
if (dev->dev.bus_id[0] == 0)
sprintf (&dev->dev.bus_id[0], "%d-%s",
dev->bus->busnum, dev->devpath);
@@ -1135,7 +1130,6 @@
dev->state = USB_STATE_DEFAULT;
clear_bit(dev->devnum, dev->bus->devmap.devicemap);
dev->devnum = -1;
- usb_put_dev(dev);
return err;
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel