1807
1807
goto free_interfaces;
1810
ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
1811
USB_REQ_SET_CONFIGURATION, 0, configuration, 0,
1812
NULL, 0, USB_CTRL_SET_TIMEOUT);
1814
/* All the old state is gone, so what else can we do?
1815
* The device is probably useless now anyway.
1820
dev->actconfig = cp;
1822
usb_set_device_state(dev, USB_STATE_ADDRESS);
1823
usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
1824
/* Leave LPM disabled while the device is unconfigured. */
1825
mutex_unlock(hcd->bandwidth_mutex);
1826
usb_autosuspend_device(dev);
1827
goto free_interfaces;
1829
mutex_unlock(hcd->bandwidth_mutex);
1830
usb_set_device_state(dev, USB_STATE_CONFIGURED);
1832
/* Initialize the new interface structures and the
1811
* Initialize the new interface structures and the
1833
1812
* hc/hcd/usbcore interface/endpoint state.
1835
1814
for (i = 0; i < nintf; ++i) {
1874
1853
kfree(new_interfaces);
1855
ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
1856
USB_REQ_SET_CONFIGURATION, 0, configuration, 0,
1857
NULL, 0, USB_CTRL_SET_TIMEOUT);
1858
if (ret < 0 && cp) {
1860
* All the old state is gone, so what else can we do?
1861
* The device is probably useless now anyway.
1863
usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
1864
for (i = 0; i < nintf; ++i) {
1865
usb_disable_interface(dev, cp->interface[i], true);
1866
put_device(&cp->interface[i]->dev);
1867
cp->interface[i] = NULL;
1872
dev->actconfig = cp;
1873
mutex_unlock(hcd->bandwidth_mutex);
1876
usb_set_device_state(dev, USB_STATE_ADDRESS);
1878
/* Leave LPM disabled while the device is unconfigured. */
1879
usb_autosuspend_device(dev);
1882
usb_set_device_state(dev, USB_STATE_CONFIGURED);
1876
1884
if (cp->string == NULL &&
1877
1885
!(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS))
1878
1886
cp->string = usb_cache_string(dev, cp->desc.iConfiguration);