summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/gadget/composite.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index acb925be0482..9b1b43a80b14 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -737,6 +737,16 @@ static int set_config(struct usb_composite_dev *cdev,
unsigned power = gadget_is_otg(gadget) ? 8 : 100;
int tmp;
+ /*
+ * ignore 2nd time SET_CONFIGURATION
+ * only for same config value twice.
+ */
+ if (cdev->config && (cdev->config->bConfigurationValue == number)) {
+ DBG(cdev, "already in the same config with value %d\n",
+ number);
+ return 0;
+ }
+
if (number) {
list_for_each_entry(c, &cdev->configs, list) {
if (c->bConfigurationValue == number) {