[V2,10/17] usb: gadget: update os_desc_config when add config

Message ID 20210125134400.780-11-peng.fan@nxp.com
State New
Headers show
Series
  • usb: gadget: update
Related show

Commit Message

Peng Fan Jan. 25, 2021, 1:43 p.m.
From: Jun Li <jun.li@nxp.com>


Always use the new added config for os_desc_config to fix cdev->
os_desc_config may miss set in case we restart usb gadget driver.

Signed-off-by: Li Jun <jun.li@nxp.com>

Signed-off-by: Peng Fan <peng.fan@nxp.com>

---
 drivers/usb/gadget/composite.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.28.0

Patch

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index e6fdefd3d0..404da12754 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -512,8 +512,8 @@  int usb_add_config(struct usb_composite_dev *cdev,
 
 	usb_ep_autoconfig_reset(cdev->gadget);
 
-	if (os_desc_config)
-		cdev->os_desc_config = os_desc_config;
+	os_desc_config = config;
+	cdev->os_desc_config = os_desc_config;
 
 done:
 	if (status)