From 6a4a38525d60db7e915d559273d8c89db5a98edf Mon Sep 17 00:00:00 2001 From: Benoit Goby Date: Mon, 28 Nov 2011 18:01:03 -0800 Subject: [PATCH] usb: gadget: android: Reset next_string_id before enable Reset next_string_id to 0 before enabling the gadget driver. Otherwise, after a large number of enable/disable cycles, bind will fail because we cannot allocate new string ids. String ids cannot be larger than 254 per USB spec. Change-Id: I44f5fece45008b7a0a18c025d4eb5ce842585c28 Signed-off-by: Benoit Goby --- drivers/usb/gadget/android.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c index d109bfb02f38..5d77899678f9 100644 --- a/drivers/usb/gadget/android.c +++ b/drivers/usb/gadget/android.c @@ -823,6 +823,7 @@ static ssize_t enable_store(struct device *pdev, struct device_attribute *attr, sscanf(buff, "%d", &enabled); if (enabled && !dev->enabled) { + cdev->next_string_id = 0; /* update values in composite driver's copy of device descriptor */ cdev->desc.idVendor = device_desc.idVendor; cdev->desc.idProduct = device_desc.idProduct; -- 2.34.1