diag: Free the read workqueue structure to avoid memory leak
The patch frees the read workqueue structure after scheduled workqueue processes the glink buffers and notifies glink to avoid possible memory leak. CRs-Fixed: 2083447 Change-Id: I4e562f9d1cbf02d8306e0a127835af85dfa5db23 Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
This commit is contained in:
parent
26bb59b7f4
commit
d276e8814c
1 changed files with 5 additions and 1 deletions
|
@ -375,8 +375,10 @@ static void diag_glink_notify_rx_work_fn(struct work_struct *work)
|
||||||
struct diag_glink_read_work, work);
|
struct diag_glink_read_work, work);
|
||||||
struct diag_glink_info *glink_info = read_work->glink_info;
|
struct diag_glink_info *glink_info = read_work->glink_info;
|
||||||
|
|
||||||
if (!glink_info || !glink_info->hdl)
|
if (!glink_info || !glink_info->hdl) {
|
||||||
|
kfree(read_work);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
diagfwd_channel_read_done(glink_info->fwd_ctxt,
|
diagfwd_channel_read_done(glink_info->fwd_ctxt,
|
||||||
(unsigned char *)(read_work->ptr_read_done),
|
(unsigned char *)(read_work->ptr_read_done),
|
||||||
|
@ -388,6 +390,7 @@ static void diag_glink_notify_rx_work_fn(struct work_struct *work)
|
||||||
"diag: Rx done for packet %pK of len: %d periph: %d ch: %d\n",
|
"diag: Rx done for packet %pK of len: %d periph: %d ch: %d\n",
|
||||||
read_work->ptr_rx_done, (int)read_work->ptr_read_size,
|
read_work->ptr_rx_done, (int)read_work->ptr_read_size,
|
||||||
glink_info->peripheral, glink_info->type);
|
glink_info->peripheral, glink_info->type);
|
||||||
|
kfree(read_work);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void diag_glink_notify_rx(void *hdl, const void *priv,
|
static void diag_glink_notify_rx(void *hdl, const void *priv,
|
||||||
|
@ -411,6 +414,7 @@ static void diag_glink_notify_rx(void *hdl, const void *priv,
|
||||||
if (!read_work) {
|
if (!read_work) {
|
||||||
DIAG_LOG(DIAG_DEBUG_PERIPHERALS,
|
DIAG_LOG(DIAG_DEBUG_PERIPHERALS,
|
||||||
"diag: Could not allocate read_work\n");
|
"diag: Could not allocate read_work\n");
|
||||||
|
glink_rx_done(glink_info->hdl, ptr, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue