diff options
author | Sai Nikhil <snikhil@nvidia.com> | 2018-08-21 02:48:10 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-08-21 17:54:27 -0400 |
commit | 05f45bcfc390c46f000f4c6b46546eebed869df6 (patch) | |
tree | 0aca01cd8e4c41d453fce8757bf37e6aec976ff0 /drivers/gpu/nvgpu/common/fuse | |
parent | 9f5a464d289f22302c81409b08f5615da89a4502 (diff) |
gpu: nvgpu: MISRA 10.3 Conversions to/from char
MISRA Rule 10.3 states that the value of an expression shall not be
assigned to an object with a narrower essential type or of a
different essential type category.
We have cases where we are converting to/from char and non char types
and this fix 10.3 violations resulting from these conversions.
This also fix violations in conversions between s8 and non-s8 types
as s8 can be typedefed as char.
Jira NVGPU-1010
Change-Id: I150dd633eb7575de9ea2bedd598b7af74d1fcbd9
Signed-off-by: Sai Nikhil <snikhil@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1801613
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/fuse')
-rw-r--r-- | drivers/gpu/nvgpu/common/fuse/fuse_gp106.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/gpu/nvgpu/common/fuse/fuse_gp106.c b/drivers/gpu/nvgpu/common/fuse/fuse_gp106.c index 17951e27..47dc49ab 100644 --- a/drivers/gpu/nvgpu/common/fuse/fuse_gp106.c +++ b/drivers/gpu/nvgpu/common/fuse/fuse_gp106.c | |||
@@ -181,50 +181,54 @@ u32 gp106_fuse_read_vin_cal_gain_offset_fuse(struct gk20a *g, | |||
181 | u32 vin_id, s8 *gain, | 181 | u32 vin_id, s8 *gain, |
182 | s8 *offset) | 182 | s8 *offset) |
183 | { | 183 | { |
184 | u32 reg_val = 0; | ||
184 | u32 data = 0; | 185 | u32 data = 0; |
185 | 186 | ||
186 | switch (vin_id) { | 187 | switch (vin_id) { |
187 | case CTRL_CLK_VIN_ID_GPC0: | 188 | case CTRL_CLK_VIN_ID_GPC0: |
188 | data = gk20a_readl(g, fuse_vin_cal_gpc0_r()); | 189 | reg_val = gk20a_readl(g, fuse_vin_cal_gpc0_r()); |
189 | break; | 190 | break; |
190 | 191 | ||
191 | case CTRL_CLK_VIN_ID_GPC1: | 192 | case CTRL_CLK_VIN_ID_GPC1: |
192 | data = gk20a_readl(g, fuse_vin_cal_gpc1_delta_r()); | 193 | reg_val = gk20a_readl(g, fuse_vin_cal_gpc1_delta_r()); |
193 | break; | 194 | break; |
194 | 195 | ||
195 | case CTRL_CLK_VIN_ID_GPC2: | 196 | case CTRL_CLK_VIN_ID_GPC2: |
196 | data = gk20a_readl(g, fuse_vin_cal_gpc2_delta_r()); | 197 | reg_val = gk20a_readl(g, fuse_vin_cal_gpc2_delta_r()); |
197 | break; | 198 | break; |
198 | 199 | ||
199 | case CTRL_CLK_VIN_ID_GPC3: | 200 | case CTRL_CLK_VIN_ID_GPC3: |
200 | data = gk20a_readl(g, fuse_vin_cal_gpc3_delta_r()); | 201 | reg_val = gk20a_readl(g, fuse_vin_cal_gpc3_delta_r()); |
201 | break; | 202 | break; |
202 | 203 | ||
203 | case CTRL_CLK_VIN_ID_GPC4: | 204 | case CTRL_CLK_VIN_ID_GPC4: |
204 | data = gk20a_readl(g, fuse_vin_cal_gpc4_delta_r()); | 205 | reg_val = gk20a_readl(g, fuse_vin_cal_gpc4_delta_r()); |
205 | break; | 206 | break; |
206 | 207 | ||
207 | case CTRL_CLK_VIN_ID_GPC5: | 208 | case CTRL_CLK_VIN_ID_GPC5: |
208 | data = gk20a_readl(g, fuse_vin_cal_gpc5_delta_r()); | 209 | reg_val = gk20a_readl(g, fuse_vin_cal_gpc5_delta_r()); |
209 | break; | 210 | break; |
210 | 211 | ||
211 | case CTRL_CLK_VIN_ID_SYS: | 212 | case CTRL_CLK_VIN_ID_SYS: |
212 | case CTRL_CLK_VIN_ID_XBAR: | 213 | case CTRL_CLK_VIN_ID_XBAR: |
213 | case CTRL_CLK_VIN_ID_LTC: | 214 | case CTRL_CLK_VIN_ID_LTC: |
214 | data = gk20a_readl(g, fuse_vin_cal_shared_delta_r()); | 215 | reg_val = gk20a_readl(g, fuse_vin_cal_shared_delta_r()); |
215 | break; | 216 | break; |
216 | 217 | ||
217 | case CTRL_CLK_VIN_ID_SRAM: | 218 | case CTRL_CLK_VIN_ID_SRAM: |
218 | data = gk20a_readl(g, fuse_vin_cal_sram_delta_r()); | 219 | reg_val = gk20a_readl(g, fuse_vin_cal_sram_delta_r()); |
219 | break; | 220 | break; |
220 | 221 | ||
221 | default: | 222 | default: |
222 | return -EINVAL; | 223 | return -EINVAL; |
223 | } | 224 | } |
224 | if (data == 0xFFFFFFFF) | 225 | if (reg_val == 0xFFFFFFFF) { |
225 | return -EINVAL; | 226 | return -EINVAL; |
226 | *gain = (s8) (data >> 16) & 0x1f; | 227 | } |
227 | *offset = (s8) data & 0x7f; | 228 | data = (reg_val >> 16U) & 0x1fU; |
229 | *gain = (s8)data; | ||
230 | data = reg_val & 0x7fU; | ||
231 | *offset = (s8)data; | ||
228 | 232 | ||
229 | return 0; | 233 | return 0; |
230 | } | 234 | } |