From 7774669a3086f64d5d9abfea48e41c10b130b9aa Mon Sep 17 00:00:00 2001 From: tkudav Date: Fri, 3 Jan 2020 15:56:08 +0530 Subject: [PATCH] gpu: nvgpu: Add branch coverage for common.fbp Add missing branch coverage for nvgpu_fbp_remove_support() corresponding to g->fbp == NULL case. JIRA NVGPU-4679 Change-Id: I2d8e97b0d35a5a6738dc649500e2172560fe121f Signed-off-by: tkudav Reviewed-on: https://git-master.nvidia.com/r/2272934 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Sagar Kamble Reviewed-by: Deepak Nibade GVS: Gerrit_Virtual_Submit Reviewed-by: mobile promotions Tested-by: mobile promotions --- userspace/units/fbp/nvgpu-fbp.c | 7 +++++++ userspace/units/fbp/nvgpu-fbp.h | 1 + 2 files changed, 8 insertions(+) diff --git a/userspace/units/fbp/nvgpu-fbp.c b/userspace/units/fbp/nvgpu-fbp.c index 99501e1ad..6866a991b 100644 --- a/userspace/units/fbp/nvgpu-fbp.c +++ b/userspace/units/fbp/nvgpu-fbp.c @@ -206,8 +206,15 @@ int test_fbp_remove_support(struct unit_module *m, struct gk20a *g, void *args) return UNIT_FAIL; } + /* + * Call fbp_remove_support with fbp pointer set to NULL for branch + * coverage. + */ + nvgpu_fbp_remove_support(g); + return ret; } + struct unit_module_test fbp_tests[] = { UNIT_TEST(fbp_setup, test_fbp_setup, NULL, 0), UNIT_TEST(fbp_init_and_query, test_fbp_init_and_query, NULL, 0), diff --git a/userspace/units/fbp/nvgpu-fbp.h b/userspace/units/fbp/nvgpu-fbp.h index d8fc9dcb1..dd67d9119 100644 --- a/userspace/units/fbp/nvgpu-fbp.h +++ b/userspace/units/fbp/nvgpu-fbp.h @@ -117,6 +117,7 @@ int test_fbp_init_and_query(struct unit_module *m, struct gk20a *g, void *args); * - Confirm if g->fbp != NULL before calling fbp_remov_support API. * - Call fbp_remove_support to cleanup the saved FBP data. * - Confirm if g->fbp == NULL after cleanup. + * - Call fbp_remove_support with fbp pointer set to NULL for branch coverage. * * Output: * - UNIT_FAIL if above API fails to cleanup g->fbp;