usb: gadget: f_mtp: Fix mtp enumeration failure issue

If cable is disconnected while send_file work is in progress,
Endpoints will be disabled and state will be marked as OFFLINE.
As a part of endpoint disable pending requests will be retire out
with -ECONNRESET error. Due to this we will modify the device state
as ERROR in completion callback. If the state is not offline then
we will mark the device state to ready in send_file_work. This results
in mtp driver to not returning any error for next mtp_write operation
and mtp release will not be called.

Hence fix this issue by adding a proper check in completions to not
moving device state to ERROR in case of disconnect.

Change-Id: Idb4e075c89bdf94790a321bc464d30eba546eeaa
Signed-off-by: ChandanaKishori Chiluveru <cchilu@codeaurora.org>
1 file changed