From 186e0291ab827c26674a8216f71dc3c7353b1e00 Mon Sep 17 00:00:00 2001 From: Philip Elcan Date: Tue, 18 Sep 2018 10:28:15 -0400 Subject: gpu: nvgpu: commonize errs in *get_litter_value() No one is checking return values for the *get_litter_value() functions in the 100s of references, and some of the *get_litter_value() functions were already doing a BUG(), we'll just call BUG() in all them. And since we don't return in the error case, and there's no guarantee that an errno won't collide with the litter values, we'll just initialize the local ret value to 0 to avoid problems and confusion. JIRA NVGPU-647 Change-Id: Id974c904a142c4b3abf1ab940121c270208b0b83 Signed-off-by: Philip Elcan Reviewed-on: https://git-master.nvidia.com/r/1830582 GVS: Gerrit_Virtual_Submit Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Scott Long Reviewed-by: Alex Waterman Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gm20b/hal_gm20b.c | 2 +- drivers/gpu/nvgpu/gp106/hal_gp106.c | 3 ++- drivers/gpu/nvgpu/gp10b/hal_gp10b.c | 2 +- drivers/gpu/nvgpu/gv100/hal_gv100.c | 4 +++- drivers/gpu/nvgpu/gv11b/hal_gv11b.c | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c index 82a510e9..55c96274 100644 --- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c @@ -73,7 +73,7 @@ u32 gm20b_get_litter_value(struct gk20a *g, int value) { - u32 ret = EINVAL; + u32 ret = 0; switch (value) { case GPU_LIT_NUM_GPCS: ret = proj_scal_litter_num_gpcs_v(); diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c index 3786b588..bbf02aab 100644 --- a/drivers/gpu/nvgpu/gp106/hal_gp106.c +++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c @@ -108,7 +108,7 @@ static u32 gp106_get_litter_value(struct gk20a *g, int value) { - u32 ret = EINVAL; + u32 ret = 0; switch (value) { case GPU_LIT_NUM_GPCS: @@ -211,6 +211,7 @@ static u32 gp106_get_litter_value(struct gk20a *g, int value) ret = proj_gpc_priv_stride_v(); break; default: + nvgpu_err(g, "Missing definition %d", value); BUG(); break; } diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index 1050c89f..a2658275 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c @@ -90,7 +90,7 @@ u32 gp10b_get_litter_value(struct gk20a *g, int value) { - u32 ret = EINVAL; + u32 ret = 0; switch (value) { case GPU_LIT_NUM_GPCS: ret = proj_scal_litter_num_gpcs_v(); diff --git a/drivers/gpu/nvgpu/gv100/hal_gv100.c b/drivers/gpu/nvgpu/gv100/hal_gv100.c index aecebf79..041422e0 100644 --- a/drivers/gpu/nvgpu/gv100/hal_gv100.c +++ b/drivers/gpu/nvgpu/gv100/hal_gv100.c @@ -127,7 +127,7 @@ static u32 gv100_get_litter_value(struct gk20a *g, int value) { - u32 ret = EINVAL; + u32 ret = 0; switch (value) { case GPU_LIT_NUM_GPCS: ret = proj_scal_litter_num_gpcs_v(); @@ -244,6 +244,8 @@ static u32 gv100_get_litter_value(struct gk20a *g, int value) ret = proj_gpc_priv_stride_v(); break; default: + nvgpu_err(g, "Missing definition %d", value); + BUG(); break; } diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c index 0ee0e6c8..a79071b7 100644 --- a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c @@ -106,7 +106,7 @@ u32 gv11b_get_litter_value(struct gk20a *g, int value) { - u32 ret = EINVAL; + u32 ret = 0; switch (value) { case GPU_LIT_NUM_GPCS: ret = proj_scal_litter_num_gpcs_v(); -- cgit v1.2.2