From d9c6faa1025d68558711decb655f32262c82d432 Mon Sep 17 00:00:00 2001 From: Philip Elcan Date: Thu, 27 Feb 2020 14:17:30 -0500 Subject: [PATCH] gpu: nvgpu: unit: mm: fix double destroy of mutex Update mm unit test for nvgpu_mm_remove_support() to avoid calling the HAL info_mem_destroy() a second time. info_mem_destroy() destroys a mutex, so if it is called a second time, it will errantly try to destroy it again. JIRA NVGPU-4987 Change-Id: I6e384b15955d4059662ded3679293456d9697a0e Signed-off-by: Philip Elcan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2304124 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Vinod Gopalakrishnakurup Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- userspace/units/mm/mm/mm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/userspace/units/mm/mm/mm.c b/userspace/units/mm/mm/mm.c index 3184e1679..b1dedf659 100644 --- a/userspace/units/mm/mm/mm.c +++ b/userspace/units/mm/mm/mm.c @@ -576,6 +576,9 @@ int test_mm_remove_mm_support(struct unit_module *m, struct gk20a *g, g->ops.mm.remove_bar2_vm = gp10b_mm_remove_bar2_vm; g->mm.remove_support(&g->mm); + /* Reset this to NULL to avoid trying to destroy the mutex again */ + g->ops.mm.mmu_fault.info_mem_destroy = NULL; + /* Extra cases for branch coverage */ nvgpu_set_enabled(g, NVGPU_SUPPORT_SEC2_VM, false); nvgpu_set_enabled(g, NVGPU_SUPPORT_GSP_VM, false);