From 5dd5c0aa94fd6013d2f8a5616c8d5f9709b72d80 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Tue, 13 Nov 2018 12:12:15 -0800 Subject: [PATCH] gpu: nvgpu: Clear dangling pointer in pd_cache This A) clears a dangling pointer which should make the code more robust, and B) allows for easier unit testing of the nvgpu_pd_cache_do_free() functions since there's now a tangible change to the nvgpu_gmmu_pd after this function runs. JIRA NVGPU-1323 Change-Id: I57db02c9e74324b8e3c3fd4a2c14565dfd0048aa Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1949936 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Nicolas Benech GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/mm/pd_cache.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/nvgpu/common/mm/pd_cache.c b/drivers/gpu/nvgpu/common/mm/pd_cache.c index a58a6759f..74ad186e2 100644 --- a/drivers/gpu/nvgpu/common/mm/pd_cache.c +++ b/drivers/gpu/nvgpu/common/mm/pd_cache.c @@ -491,6 +491,8 @@ static void nvgpu_pd_cache_do_free(struct gk20a *g, /* Empty now so free it. */ nvgpu_pd_cache_free_mem_entry(g, cache, pentry); } + + pd->mem = NULL; } static struct nvgpu_pd_mem_entry *nvgpu_pd_cache_look_up(