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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user