From 43861331c5c9832a1f7c9ae6c96895a4253f250c Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Mon, 12 Mar 2018 15:46:22 -0700 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1673826 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gp106/therm_gp106.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@ void gp106_get_internal_sensor_limits(s32 *max_24_8, s32 *min_24_8) { *max_24_8 = (0x87 << 8); - *min_24_8 = ((-216) << 8); + *min_24_8 = (((u32)-216) << 8); } int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8) -- cgit v1.2.2