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 <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2184929
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Philip Elcan
2019-08-27 17:07:02 -04:00
committed by mobile promotions
parent 373e7e8452
commit 529d40103f

View File

@@ -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");