summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Elcan <pelcan@nvidia.com>2018-09-18 10:28:15 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-09-26 19:45:03 -0400
commit186e0291ab827c26674a8216f71dc3c7353b1e00 (patch)
tree4dc504943bc3405269e1ed74642d7a53abefbb4e
parent07e5bd817a23913d120b945ced5c96951716886c (diff)
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 <pelcan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1830582 GVS: Gerrit_Virtual_Submit Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Scott Long <scottl@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gm20b/hal_gm20b.c2
-rw-r--r--drivers/gpu/nvgpu/gp106/hal_gp106.c3
-rw-r--r--drivers/gpu/nvgpu/gp10b/hal_gp10b.c2
-rw-r--r--drivers/gpu/nvgpu/gv100/hal_gv100.c4
-rw-r--r--drivers/gpu/nvgpu/gv11b/hal_gv11b.c2
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 @@
73 73
74u32 gm20b_get_litter_value(struct gk20a *g, int value) 74u32 gm20b_get_litter_value(struct gk20a *g, int value)
75{ 75{
76 u32 ret = EINVAL; 76 u32 ret = 0;
77 switch (value) { 77 switch (value) {
78 case GPU_LIT_NUM_GPCS: 78 case GPU_LIT_NUM_GPCS:
79 ret = proj_scal_litter_num_gpcs_v(); 79 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 @@
108 108
109static u32 gp106_get_litter_value(struct gk20a *g, int value) 109static u32 gp106_get_litter_value(struct gk20a *g, int value)
110{ 110{
111 u32 ret = EINVAL; 111 u32 ret = 0;
112 112
113 switch (value) { 113 switch (value) {
114 case GPU_LIT_NUM_GPCS: 114 case GPU_LIT_NUM_GPCS:
@@ -211,6 +211,7 @@ static u32 gp106_get_litter_value(struct gk20a *g, int value)
211 ret = proj_gpc_priv_stride_v(); 211 ret = proj_gpc_priv_stride_v();
212 break; 212 break;
213 default: 213 default:
214 nvgpu_err(g, "Missing definition %d", value);
214 BUG(); 215 BUG();
215 break; 216 break;
216 } 217 }
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 @@
90 90
91u32 gp10b_get_litter_value(struct gk20a *g, int value) 91u32 gp10b_get_litter_value(struct gk20a *g, int value)
92{ 92{
93 u32 ret = EINVAL; 93 u32 ret = 0;
94 switch (value) { 94 switch (value) {
95 case GPU_LIT_NUM_GPCS: 95 case GPU_LIT_NUM_GPCS:
96 ret = proj_scal_litter_num_gpcs_v(); 96 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 @@
127 127
128static u32 gv100_get_litter_value(struct gk20a *g, int value) 128static u32 gv100_get_litter_value(struct gk20a *g, int value)
129{ 129{
130 u32 ret = EINVAL; 130 u32 ret = 0;
131 switch (value) { 131 switch (value) {
132 case GPU_LIT_NUM_GPCS: 132 case GPU_LIT_NUM_GPCS:
133 ret = proj_scal_litter_num_gpcs_v(); 133 ret = proj_scal_litter_num_gpcs_v();
@@ -244,6 +244,8 @@ static u32 gv100_get_litter_value(struct gk20a *g, int value)
244 ret = proj_gpc_priv_stride_v(); 244 ret = proj_gpc_priv_stride_v();
245 break; 245 break;
246 default: 246 default:
247 nvgpu_err(g, "Missing definition %d", value);
248 BUG();
247 break; 249 break;
248 } 250 }
249 251
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 @@
106 106
107u32 gv11b_get_litter_value(struct gk20a *g, int value) 107u32 gv11b_get_litter_value(struct gk20a *g, int value)
108{ 108{
109 u32 ret = EINVAL; 109 u32 ret = 0;
110 switch (value) { 110 switch (value) {
111 case GPU_LIT_NUM_GPCS: 111 case GPU_LIT_NUM_GPCS:
112 ret = proj_scal_litter_num_gpcs_v(); 112 ret = proj_scal_litter_num_gpcs_v();