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>
This commit is contained in:
Alex Waterman
2018-03-12 15:46:22 -07:00
committed by mobile promotions
parent 182760476d
commit 43861331c5

View File

@@ -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)