Skip to content

Commit 2efab2c

Browse files
Junlisuzhougregkh
authored andcommitted
usb: gadget: mass_storage: set msg_registered after msg registered
commit 8e55d30322c6a0ef746c256a1beda9c73ecb27a6 upstream. If there is no UDC available, the msg register will fail and this flag will not be set, but the driver is already added into pending driver list, then the module removal modprobe -r can not remove the driver from the pending list. Signed-off-by: Li Jun <jun.li@nxp.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b74a454 commit 2efab2c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/usb/gadget/legacy/mass_storage.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ static int msg_bind(struct usb_composite_dev *cdev)
210210
usb_composite_overwrite_options(cdev, &coverwrite);
211211
dev_info(&cdev->gadget->dev,
212212
DRIVER_DESC ", version: " DRIVER_VERSION "\n");
213-
set_bit(0, &msg_registered);
214213
return 0;
215214

216215
fail_otg_desc:
@@ -257,7 +256,12 @@ MODULE_LICENSE("GPL");
257256

258257
static int __init msg_init(void)
259258
{
260-
return usb_composite_probe(&msg_driver);
259+
int ret;
260+
261+
ret = usb_composite_probe(&msg_driver);
262+
set_bit(0, &msg_registered);
263+
264+
return ret;
261265
}
262266
module_init(msg_init);
263267

0 commit comments

Comments
 (0)