diag: Set context properly while sending command responses

Currently, setting of context is not proper while sending
command responses due to which modem command response
buffer is getting corrupted leading to modem qshrink4
qdb file corruption. This patch fixes the issue by
setting the context properly.

CRs-Fixed: 2026664
Change-Id: I4bd2c23feaaf8a75a5a256d28377878519b507c6
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
This commit is contained in:
Mohit Aggarwal 2017-04-04 22:02:48 +05:30
parent 28e87e960f
commit 8901694f22

View file

@ -259,11 +259,17 @@ static void pack_rsp_and_send(unsigned char *buf, int len,
}
if (info && info->peripheral_mask) {
for (i = 0; i <= NUM_PERIPHERALS; i++) {
if (info->peripheral_mask & (1 << i))
break;
if (info->peripheral_mask == DIAG_CON_ALL ||
(info->peripheral_mask & (1 << APPS_DATA)) ||
(info->peripheral_mask & (1 << PERIPHERAL_MODEM))) {
rsp_ctxt = SET_BUF_CTXT(APPS_DATA, TYPE_CMD, 1);
} else {
for (i = 0; i <= NUM_PERIPHERALS; i++) {
if (info->peripheral_mask & (1 << i))
break;
}
rsp_ctxt = SET_BUF_CTXT(i, TYPE_CMD, 1);
}
rsp_ctxt = SET_BUF_CTXT(i, TYPE_CMD, 1);
} else
rsp_ctxt = driver->rsp_buf_ctxt;
@ -337,11 +343,17 @@ static void encode_rsp_and_send(unsigned char *buf, int len,
}
if (info && info->peripheral_mask) {
for (i = 0; i <= NUM_PERIPHERALS; i++) {
if (info->peripheral_mask & (1 << i))
break;
if (info->peripheral_mask == DIAG_CON_ALL ||
(info->peripheral_mask & (1 << APPS_DATA)) ||
(info->peripheral_mask & (1 << PERIPHERAL_MODEM))) {
rsp_ctxt = SET_BUF_CTXT(APPS_DATA, TYPE_CMD, 1);
} else {
for (i = 0; i <= NUM_PERIPHERALS; i++) {
if (info->peripheral_mask & (1 << i))
break;
}
rsp_ctxt = SET_BUF_CTXT(i, TYPE_CMD, 1);
}
rsp_ctxt = SET_BUF_CTXT(i, TYPE_CMD, 1);
} else
rsp_ctxt = driver->rsp_buf_ctxt;