USB: gadget: diag: Free USB requests during composition switch

Diag char driver allocates and frees USB requests from workqueue
context as part of USB connect and disconnect notifications.
There is possibility that by the time diag char's worqueue
requests USB to free up USB requests, USB DIAG is already UNBOUND
(as part of composition switch) or DISABLED (as part of cable
disconnect) resulting in requests not getting freed. Second
scenario is handled in the code by freeing the USB requests as
part of next cable connect but first scenario is not handled, which
results in memory leak. Handle this by freeing USB requests during
unbind before releasing reference to USB DIAG device context.

Change-Id: I59afb989ea3b4e60dc3287db6e281952fb880427
CRs-Fixed: 506822
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
1 file changed