From 9a2517c25152ad6cc8689b54098a2d941ab851ac Mon Sep 17 00:00:00 2001 From: Himateja Reddy Date: Tue, 8 Sep 2020 08:21:55 -0700 Subject: [PATCH] msm: adsprpc: Free dma handles in RPC call with no parameters Currently dma handles are not freed in the RPC call with no parameters. This will cause fastrpc driver to hold the memory of the dma handle, that is freed in both DSP and application user space. Free dma handles even in the RPC call with no parameters. Change-Id: Ica5bfc98edc07b77f79bfaf75630508b8c9ee1af Signed-off-by: Himateja Reddy --- drivers/char/adsprpc.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index 21c344956c99..bf9903514909 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -2562,14 +2562,12 @@ static int put_args(uint32_t kernel, struct smq_invoke_ctx *ctx, } } mutex_lock(&ctx->fl->map_mutex); - if (inbufs + outbufs + handles) { - for (i = 0; i < M_FDLIST; i++) { - if (!fdlist[i]) - break; - if (!fastrpc_mmap_find(ctx->fl, (int)fdlist[i], 0, 0, - 0, 0, &mmap)) - fastrpc_mmap_free(mmap, 0); - } + for (i = 0; i < M_FDLIST; i++) { + if (!fdlist[i]) + break; + if (!fastrpc_mmap_find(ctx->fl, (int)fdlist[i], 0, 0, + 0, 0, &mmap)) + fastrpc_mmap_free(mmap, 0); } mutex_unlock(&ctx->fl->map_mutex); if (ctx->crc && crclist && rpra) @@ -2981,13 +2979,11 @@ static int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode, if (err) goto bail; isasyncinvoke = (ctx->asyncjob.isasyncjob ? true : false); - if (REMOTE_SCALARS_LENGTH(ctx->sc)) { - PERF(fl->profile, GET_COUNTER(perf_counter, PERF_GETARGS), - VERIFY(err, 0 == (err = get_args(kernel, ctx))); - PERF_END); - if (err) - goto bail; - } + PERF(fl->profile, GET_COUNTER(perf_counter, PERF_GETARGS), + VERIFY(err, 0 == (err = get_args(kernel, ctx))); + PERF_END); + if (err) + goto bail; PERF(fl->profile, GET_COUNTER(perf_counter, PERF_INVARGS), inv_args(ctx);