From b57f957da32225f88d2134ed80aaa6ebf3326fda Mon Sep 17 00:00:00 2001 From: Manoj Prabhu B Date: Wed, 10 May 2017 11:01:37 +0530 Subject: [PATCH] memshare: Update the free memory count after allocation The patch updates the client's free memory count variable after the successful allocation. CRs-Fixed: 2046258 Change-Id: Ibae317596557e23d2b2278daf433bd293a8bd0be Signed-off-by: Manoj Prabhu B --- drivers/soc/qcom/memshare/msm_memshare.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/soc/qcom/memshare/msm_memshare.c b/drivers/soc/qcom/memshare/msm_memshare.c index c11114528d2a..7406dba44320 100644 --- a/drivers/soc/qcom/memshare/msm_memshare.c +++ b/drivers/soc/qcom/memshare/msm_memshare.c @@ -524,10 +524,6 @@ static int handle_alloc_generic_req(void *req_h, void *req, void *conn_h) return -EINVAL; } - memblock[client_id].free_memory += 1; - pr_debug("memshare: In %s, free memory count for client id: %d = %d", - __func__, memblock[client_id].client_id, - memblock[client_id].free_memory); if (!memblock[client_id].alloted) { if (alloc_req->client_id == 1 && alloc_req->num_bytes > 0) size = alloc_req->num_bytes + MEMSHARE_GUARD_BYTES; @@ -541,11 +537,16 @@ static int handle_alloc_generic_req(void *req_h, void *req, void *conn_h) resp = 1; } if (!resp) { + memblock[client_id].free_memory += 1; memblock[client_id].alloted = 1; memblock[client_id].size = alloc_req->num_bytes; memblock[client_id].peripheral = alloc_req->proc_id; } } + pr_debug("memshare: In %s, free memory count for client id: %d = %d", + __func__, memblock[client_id].client_id, + memblock[client_id].free_memory); + memblock[client_id].sequence_id = alloc_req->sequence_id; fill_alloc_response(alloc_resp, client_id, &resp); -- 2.11.0