desc = &intf->altsetting [0].desc; 
int usb_set_configuration(struct usb_device *dev, int configuration){	int i, ret;	struct usb_host_config *cp = NULL;	struct usb_interface **new_interfaces = NULL;	int n, nintf;	for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {		if (dev->config[i].desc.bConfigurationValue == configuration) {			cp = &dev->config[i];			break;		}	}	if ((!cp && configuration != 0))		return -EINVAL;	/* The USB spec says configuration 0 means unconfigured.	 * But if a device includes a configuration numbered 0,	 * we will accept it as a correctly configured state.	 */	if (cp && configuration == 0)		dev_warn(&dev->dev, "config 0 descriptor??\n");	if (dev->state == USB_STATE_SUSPENDED)		return -EHOSTUNREACH;	/* Allocate memory for new interfaces before doing anything else,	 * so that if we run out then nothing will have changed. */	n = nintf = 0;	if (cp) {		nintf = cp->desc.bNumInterfaces;		new_interfaces = kmalloc(nintf * sizeof(*new_interfaces),				GFP_KERNEL);		if (!new_interfaces) {			dev_err(&dev->dev, "Out of memory");			return -ENOMEM;		}		for (; n < nintf; ++n) {			new_interfaces[n] = kzalloc(					sizeof(struct usb_interface),					GFP_KERNEL);			if (!new_interfaces[n]) {				dev_err(&dev->dev, "Out of memory");				ret = -ENOMEM;free_interfaces:				while (--n >= 0)					kfree(new_interfaces[n]);				kfree(new_interfaces);				return ret;			}		}	}	/* if it's already configured, clear out old state first.	 * getting rid of old interfaces means unbinding their drivers.	 */	if (dev->state != USB_STATE_ADDRESS)		usb_disable_device (dev, 1);	// Skip ep0	if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),			USB_REQ_SET_CONFIGURATION, 0, configuration, 0,			NULL, 0, USB_CTRL_SET_TIMEOUT)) < 0)		goto free_interfaces;	dev->actconfig = cp;	if (!cp)		usb_set_device_state(dev, USB_STATE_ADDRESS);	else {		usb_set_device_state(dev, USB_STATE_CONFIGURED);		/* Initialize the new interface structures and the		 * hc/hcd/usbcore interface/endpoint state.		 */		for (i = 0; i < nintf; ++i) {			struct usb_interface_cache *intfc;			struct usb_interface *intf;			struct usb_host_interface *alt;			cp->interface[i] = intf = new_interfaces[i];			intfc = cp->intf_cache[i];			intf->altsetting = intfc->altsetting;			intf->num_altsetting = intfc->num_altsetting;			kref_get(&intfc->ref);			alt = usb_altnum_to_altsetting(intf, 0);			/* No altsetting 0?  We'll assume the first altsetting.			 * We could use a GetInterface call, but if a device is			 * so non-compliant that it doesn't have altsetting 0			 * then I wouldn't trust its reply anyway.			 */			if (!alt)				alt = &intf->altsetting[0];			intf->cur_altsetting = alt;			usb_enable_interface(dev, intf);			intf->dev.parent = &dev->dev;			intf->dev.driver = NULL;			intf->dev.bus = &usb_bus_type;			intf->dev.dma_mask = dev->dev.dma_mask;			intf->dev.release = release_interface;			device_initialize (&intf->dev);			mark_quiesced(intf);			sprintf (&intf->dev.bus_id[0], "%d-%s:%d.%d",				 dev->bus->busnum, dev->devpath,				 configuration,				 alt->desc.bInterfaceNumber);		}		kfree(new_interfaces);		if ((cp->desc.iConfiguration) &&		    (cp->string == NULL)) {			cp->string = kmalloc(256, GFP_KERNEL);			if (cp->string)				usb_string(dev, cp->desc.iConfiguration, cp->string, 256);		}		/* Now that all the interfaces are set up, register them		 * to trigger binding of drivers to interfaces.  probe()		 * routines may install different altsettings and may		 * claim() any interfaces not yet bound.  Many class drivers		 * need that: CDC, audio, video, etc.		 */		for (i = 0; i < nintf; ++i) {			struct usb_interface *intf = cp->interface[i];			struct usb_interface_descriptor *desc;			desc = &intf->altsetting [0].desc;			dev_dbg (&dev->dev,				"adding %s (config #%d, interface %d)\n",				intf->dev.bus_id, configuration,				desc->bInterfaceNumber);			ret = device_add (&intf->dev);			if (ret != 0) {				dev_err(&dev->dev,					"device_add(%s) --> %d\n",					intf->dev.bus_id,					ret);				continue;			}			if ((intf->cur_altsetting->desc.iInterface) &&			    (intf->cur_altsetting->string == NULL)) {				intf->cur_altsetting->string = kmalloc(256, GFP_KERNEL);				if (intf->cur_altsetting->string)					usb_string(dev, intf->cur_altsetting->desc.iInterface,						   intf->cur_altsetting->string, 256);			}			usb_create_sysfs_intf_files (intf);		}	}	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/4f62efe67f077db17dad03a1d4c9665000a3eb45/message.c/buggy/drivers/usb/core/message.c