summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Solaira <gustavos@codeaurora.org>2018-08-03 19:08:46 -0700
committerGustavo Solaira <gustavos@codeaurora.org>2018-08-03 19:15:12 -0700
commitf185067e36857b7aca56e1ec232b9516ead51f1d (patch)
treef315ade7350d2b799a3f75b00647735700c2af97
parent11ee621aea156ba9e1854335b0708f42fca975c7 (diff)
diag: Fix HSIC read complete work function
Only call kfree if the item is valid and drain the whole buffer before leaving the work function. Change-Id: Ie9c253c394be1aa859789262e0f03a986a4ad207 Signed-off-by: Gustavo Solaira <gustavos@codeaurora.org>
-rw-r--r--drivers/char/diag/diagfwd_hsic.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/char/diag/diagfwd_hsic.c b/drivers/char/diag/diagfwd_hsic.c
index 1f161777aca5..87942d8f6341 100644
--- a/drivers/char/diag/diagfwd_hsic.c
+++ b/drivers/char/diag/diagfwd_hsic.c
@@ -328,13 +328,16 @@ static void hsic_read_complete_work_fn(struct work_struct *work)
read_complete_work);
struct diag_hsic_buf_tbl_t *item;
- item = hsic_buf_tbl_pop(ch);
- if (item) {
- if (diag_remote_dev_read_done(ch->dev_id, item->buf, item->len))
- goto fail;
- }
+ do {
+ item = hsic_buf_tbl_pop(ch);
+ if (item) {
+ if (diag_remote_dev_read_done(ch->dev_id,
+ item->buf, item->len))
+ goto fail;
+ kfree(item);
+ }
+ } while (item);
- kfree(item);
return;
fail: