summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Jun <jun.li@nxp.com>2017-04-14 19:12:07 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-12 11:27:32 +0200
commit2efab2c3a3ae18a6fe33d958230c480f7268e235 (patch)
tree6ab6d9065f80910118c26b2ba49b7dec45bcb3b7
parentb74a45450f80a56a3aca515dd147bd95b18394bf (diff)
downloadlinux-stable-2efab2c3a3ae18a6fe33d958230c480f7268e235.tar.gz
linux-stable-2efab2c3a3ae18a6fe33d958230c480f7268e235.tar.bz2
linux-stable-2efab2c3a3ae18a6fe33d958230c480f7268e235.zip
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>
-rw-r--r--drivers/usb/gadget/legacy/mass_storage.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/usb/gadget/legacy/mass_storage.c b/drivers/usb/gadget/legacy/mass_storage.c
index 99aa22c81770..dd3fbad566fa 100644
--- a/drivers/usb/gadget/legacy/mass_storage.c
+++ b/drivers/usb/gadget/legacy/mass_storage.c
@@ -210,7 +210,6 @@ static int msg_bind(struct usb_composite_dev *cdev)
usb_composite_overwrite_options(cdev, &coverwrite);
dev_info(&cdev->gadget->dev,
DRIVER_DESC ", version: " DRIVER_VERSION "\n");
- set_bit(0, &msg_registered);
return 0;
fail_otg_desc:
@@ -257,7 +256,12 @@ MODULE_LICENSE("GPL");
static int __init msg_init(void)
{
- return usb_composite_probe(&msg_driver);
+ int ret;
+
+ ret = usb_composite_probe(&msg_driver);
+ set_bit(0, &msg_registered);
+
+ return ret;
}
module_init(msg_init);