|
@@ -2235,17 +2235,13 @@ static int usb_enumerate_device(struct usb_device *udev)
|
|
|
return err;
|
|
|
}
|
|
|
}
|
|
|
- if (udev->wusb == 1 && udev->authorized == 0) {
|
|
|
- udev->product = kstrdup("n/a (unauthorized)", GFP_KERNEL);
|
|
|
- udev->manufacturer = kstrdup("n/a (unauthorized)", GFP_KERNEL);
|
|
|
- udev->serial = kstrdup("n/a (unauthorized)", GFP_KERNEL);
|
|
|
- } else {
|
|
|
- /* read the standard strings and cache them if present */
|
|
|
- udev->product = usb_cache_string(udev, udev->descriptor.iProduct);
|
|
|
- udev->manufacturer = usb_cache_string(udev,
|
|
|
- udev->descriptor.iManufacturer);
|
|
|
- udev->serial = usb_cache_string(udev, udev->descriptor.iSerialNumber);
|
|
|
- }
|
|
|
+
|
|
|
+ /* read the standard strings and cache them if present */
|
|
|
+ udev->product = usb_cache_string(udev, udev->descriptor.iProduct);
|
|
|
+ udev->manufacturer = usb_cache_string(udev,
|
|
|
+ udev->descriptor.iManufacturer);
|
|
|
+ udev->serial = usb_cache_string(udev, udev->descriptor.iSerialNumber);
|
|
|
+
|
|
|
err = usb_enumerate_device_otg(udev);
|
|
|
if (err < 0)
|
|
|
return err;
|
|
@@ -2427,16 +2423,6 @@ int usb_deauthorize_device(struct usb_device *usb_dev)
|
|
|
usb_dev->authorized = 0;
|
|
|
usb_set_configuration(usb_dev, -1);
|
|
|
|
|
|
- kfree(usb_dev->product);
|
|
|
- usb_dev->product = kstrdup("n/a (unauthorized)", GFP_KERNEL);
|
|
|
- kfree(usb_dev->manufacturer);
|
|
|
- usb_dev->manufacturer = kstrdup("n/a (unauthorized)", GFP_KERNEL);
|
|
|
- kfree(usb_dev->serial);
|
|
|
- usb_dev->serial = kstrdup("n/a (unauthorized)", GFP_KERNEL);
|
|
|
-
|
|
|
- usb_destroy_configuration(usb_dev);
|
|
|
- usb_dev->descriptor.bNumConfigurations = 0;
|
|
|
-
|
|
|
out_unauthorized:
|
|
|
usb_unlock_device(usb_dev);
|
|
|
return 0;
|
|
@@ -2464,17 +2450,7 @@ int usb_authorize_device(struct usb_device *usb_dev)
|
|
|
goto error_device_descriptor;
|
|
|
}
|
|
|
|
|
|
- kfree(usb_dev->product);
|
|
|
- usb_dev->product = NULL;
|
|
|
- kfree(usb_dev->manufacturer);
|
|
|
- usb_dev->manufacturer = NULL;
|
|
|
- kfree(usb_dev->serial);
|
|
|
- usb_dev->serial = NULL;
|
|
|
-
|
|
|
usb_dev->authorized = 1;
|
|
|
- result = usb_enumerate_device(usb_dev);
|
|
|
- if (result < 0)
|
|
|
- goto error_enumerate;
|
|
|
/* Choose and set the configuration. This registers the interfaces
|
|
|
* with the driver core and lets interface drivers bind to them.
|
|
|
*/
|
|
@@ -2490,7 +2466,6 @@ int usb_authorize_device(struct usb_device *usb_dev)
|
|
|
}
|
|
|
dev_info(&usb_dev->dev, "authorized to connect\n");
|
|
|
|
|
|
-error_enumerate:
|
|
|
error_device_descriptor:
|
|
|
usb_autosuspend_device(usb_dev);
|
|
|
error_autoresume:
|