diag: Close MD session when switching to USB Mode

Cannot switch from  memory device logging to USB Mode after
the first switch because the first MD state is stored.
This fix resets the MD state by closing the session when
switching to USB Mode from MD mode.

Change-Id: I9addf0c7d8f1c058485349e196c1dcaa54b92f3a
CRs-Fixed: 972027
Signed-off-by: Chris Lew <clew@codeaurora.org>
This commit is contained in:
Chris Lew 2016-02-22 11:04:26 -08:00 committed by David Keitel
parent 9dfa33b76b
commit 029eebcb5e

View file

@ -1340,6 +1340,7 @@ static int diag_md_session_check(int curr_mode, int req_mode,
uint8_t *change_mode)
{
int err = 0;
struct diag_md_session_t *session_info = NULL;
if (!param || !change_mode)
return -EIO;
@ -1404,8 +1405,10 @@ static int diag_md_session_check(int curr_mode, int req_mode,
"another instance running\n");
*change_mode = 0;
return -EINVAL;
} else
return 0;
}
session_info = diag_md_session_get_pid(current->tgid);
diag_md_session_close(session_info);
return 0;
}
if (param->mode_param == DIAG_MD_NORMAL) {