On Thu, 18 Sep 2003, David Brownell wrote: > You might be right that another put_device() is needed, but > if so I've to to suspect that's because there's an extra > get_device() ... like the one in "config.c". Isn't the > object initialized to count == 1, so that get_device() makes > usbcore track count == 2 for just one copy of that pointer?
That's right, and you're also right that there's an extra get_device(). In fact, there are two extra. The first is indeed in config.c; this patch (as111) gets rid of it. ===== config.c 1.25 vs edited ===== --- 1.25/drivers/usb/core/config.c Mon Sep 15 10:14:46 2003 +++ edited/drivers/usb/core/config.c Fri Sep 19 17:07:29 2003 @@ -237,9 +237,6 @@ memset(interface, 0, sizeof(struct usb_interface)); interface->dev.release = usb_release_intf; device_initialize(&interface->dev); - - /* put happens in usb_destroy_configuration */ - get_device(&interface->dev); } /* Go through the descriptors, checking their length and counting the The other is in usb.c:usb_new_device(). Neither the get_device() nor the put_device() in the function should be there. The patch below, which applies on top of David's usb_set_configuration() rework patch, takes care of them. Probably both of these mistakes arose from someone not realizing that device_initialize() already sets the reference count to 1. Alan Stern --- orig/drivers/usb/core/usb.c Fri Sep 19 17:09:00 2003 +++ edited/drivers/usb/core/usb.c Fri Sep 19 17:09:42 2003 @@ -1009,7 +1009,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 +1134,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