From 529d40103f524ac972020d465c29f6a748ef96a8 Mon Sep 17 00:00:00 2001 From: Philip Elcan Date: Tue, 27 Aug 2019 17:07:02 -0400 Subject: [PATCH] gpu: nvgpu: unit: init: improve branch coverage for nvgpu_put This adds tests for testing some NULL pointer checks in the nvgpu_put() code paths that weren't covered. JIRA NVGPU-2239 Change-Id: I7b4e3d26644bab0aadff4d3bf5ecdb951e391ec8 Signed-off-by: Philip Elcan Reviewed-on: https://git-master.nvidia.com/r/2184929 GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- userspace/units/init/nvgpu-init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/userspace/units/init/nvgpu-init.c b/userspace/units/init/nvgpu-init.c index ce6abb067..0e6831e2e 100644 --- a/userspace/units/init/nvgpu-init.c +++ b/userspace/units/init/nvgpu-init.c @@ -266,6 +266,8 @@ int test_get_put(struct unit_module *m, /* to cover the cases where these are set */ g->remove_support = no_return; g->gfree = no_return; + g->ops.gr.ecc.ecc_remove_support = no_return; + g->ops.ltc.ltc_remove_support = no_return; if (g != nvgpu_get(g)) { ret = UNIT_FAIL; @@ -597,6 +599,7 @@ int test_poweroff(struct unit_module *m, struct gk20a *g, void *args) g->ops.mc.intr_mask = NULL; g->ops.mc.log_pending_intrs = NULL; g->ops.channel.suspend_all_serviceable_ch = NULL; + g->ops.clk.suspend_clk_support = NULL; err = nvgpu_prepare_poweroff(g); if (err != 0) { unit_return_fail(m, "nvgpu_prepare_poweroff returned fail\n");