summaryrefslogtreecommitdiff
path: root/drivers/char/diag/diagfwd_mhi.c
diff options
context:
space:
mode:
authorChris Lew <clew@codeaurora.org>2016-08-24 15:31:27 -0700
committerChris Lew <clew@codeaurora.org>2016-08-25 18:21:42 -0700
commitf0644715361abf12f4387084c1fe0f76a0c640ee (patch)
tree4081c81621d0fc837643cab0e56a7c6bd61913f2 /drivers/char/diag/diagfwd_mhi.c
parente97b6a0e0217f7c072fdad6c50673cd7a64348e1 (diff)
diag: Add error handler to free buffers when fwd fails
Forwarding the data from the MHI layer can fail if USB or MD is not connected. This change adds an error case to free the buffers if forwarding the data fails. CRs-Fixed: 1054875 Change-Id: I49ef2a32ffd731ab2875c941c9d11155f2aba9e2 Signed-off-by: Chris Lew <clew@codeaurora.org>
Diffstat (limited to 'drivers/char/diag/diagfwd_mhi.c')
-rw-r--r--drivers/char/diag/diagfwd_mhi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/char/diag/diagfwd_mhi.c b/drivers/char/diag/diagfwd_mhi.c
index b8ed216faaf6..f7b1e98f22b0 100644
--- a/drivers/char/diag/diagfwd_mhi.c
+++ b/drivers/char/diag/diagfwd_mhi.c
@@ -404,8 +404,11 @@ static void mhi_read_done_work_fn(struct work_struct *work)
* buffers here and do not forward them to the mux layer.
*/
if ((atomic_read(&(mhi_info->read_ch.opened)))) {
- diag_remote_dev_read_done(mhi_info->dev_id, buf,
+ err = diag_remote_dev_read_done(mhi_info->dev_id, buf,
result.bytes_xferd);
+ if (err)
+ mhi_buf_tbl_remove(mhi_info, TYPE_MHI_READ_CH,
+ buf, result.bytes_xferd);
} else {
mhi_buf_tbl_remove(mhi_info, TYPE_MHI_READ_CH, buf,
result.bytes_xferd);