summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHemant Kumar <hemantk@codeaurora.org>2016-08-08 16:20:15 -0700
committerDmitry Shmidt <dimitrysh@google.com>2018-01-08 09:03:14 -0800
commitb54d99aa12b4d02a66bf976fb85b6f0ed9a5a485 (patch)
tree7e39b26a82b2c73dad31337a57ec0ea5e9f25209
parent5f5e5d4041e31dfe9605713248a7a66754d224c7 (diff)
ANDROID: usb: f_fs: Prevent gadget unbind if it is already unbound
Upon usb composition switch there is possibility of ep0 file release happening after gadget driver bind. In case of composition switch from adb to a non-adb composition gadget will never gets bound again resulting into failure of usb device enumeration. Fix this issue by checking FFS_FL_BOUND flag and avoid extra gadget driver unbind if it is already done as part of composition switch. Change-Id: I1638001ff4a94f08224b188aa42425f3d732fa2b Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
-rw-r--r--drivers/usb/gadget/function/f_fs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 7b107e43b1c4..d90bf57ba30e 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -3725,7 +3725,8 @@ static void ffs_closed(struct ffs_data *ffs)
ci = opts->func_inst.group.cg_item.ci_parent->ci_parent;
ffs_dev_unlock();
- unregister_gadget_item(ci);
+ if (test_bit(FFS_FL_BOUND, &ffs->flags))
+ unregister_gadget_item(ci);
return;
done:
ffs_dev_unlock();