From 030ffadb08773008a031f836f36393fdc6bd4774 Mon Sep 17 00:00:00 2001 From: Vivek Date: Tue, 11 Jun 2019 12:10:25 +0530 Subject: [PATCH] qcacmn: Free srng buffer only when allocation is successful In srng setup, we set srng alloc size, and allocate memory for srng buffers. Even if allocation fails, srng alloc size is set, which is done even before the allocation is attempted. In srng clean up path, we attempt to free the memory, since srng alloc size is set, but for which allocation had failed, Instead, when freeing srng buffers, check if we have a valid address also for srng buffer and then free, instead of checking srng alloc size only. Change-Id: I1f2de526e27b7b8d97535bf4c2235c82ffd3ce5f CRs-Fixed: 2452219 --- dp/wifi3.0/dp_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 7551d7205444..9a4d62f7cd58 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -1358,7 +1358,7 @@ static void dp_srng_cleanup(struct dp_soc *soc, struct dp_srng *srng, } } - if (srng->alloc_size) { + if (srng->alloc_size && srng->base_vaddr_unaligned) { if (!srng->cached) { qdf_mem_free_consistent(soc->osdev, soc->osdev->dev, srng->alloc_size, @@ -1368,6 +1368,7 @@ static void dp_srng_cleanup(struct dp_soc *soc, struct dp_srng *srng, qdf_mem_free(srng->base_vaddr_unaligned); } srng->alloc_size = 0; + srng->base_vaddr_unaligned = NULL; } srng->hal_srng = NULL; }