diff options
author | Alex Waterman <alexw@nvidia.com> | 2018-03-12 18:46:22 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-04-05 14:24:09 -0400 |
commit | 43861331c5c9832a1f7c9ae6c96895a4253f250c (patch) | |
tree | 2011fc368a793b4d2862e96e7bb5ad62ebcb2ff5 /drivers/gpu | |
parent | 182760476dbd1415ef9a6c0c33dba0adc4dde1ef (diff) |
gpu: nvgpu: Cast negative int to u32 before shift
A shift of a negative number is undefined; so to work around
said warning simply cast to a u32 first. In this case the
resulting operation should be ok since the sign bits are
maintained when the 32 bit negative integer is shifted into
a 24 bit negative integer.
JIRA NVGPU-525
Change-Id: I0a35b0ccbccbcf4ac1b0767acad75c082143429e
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1673826
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/gp106/therm_gp106.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gp106/therm_gp106.c b/drivers/gpu/nvgpu/gp106/therm_gp106.c index ab5563cc..64d602cf 100644 --- a/drivers/gpu/nvgpu/gp106/therm_gp106.c +++ b/drivers/gpu/nvgpu/gp106/therm_gp106.c | |||
@@ -35,7 +35,7 @@ | |||
35 | void gp106_get_internal_sensor_limits(s32 *max_24_8, s32 *min_24_8) | 35 | void gp106_get_internal_sensor_limits(s32 *max_24_8, s32 *min_24_8) |
36 | { | 36 | { |
37 | *max_24_8 = (0x87 << 8); | 37 | *max_24_8 = (0x87 << 8); |
38 | *min_24_8 = ((-216) << 8); | 38 | *min_24_8 = (((u32)-216) << 8); |
39 | } | 39 | } |
40 | 40 | ||
41 | int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8) | 41 | int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8) |