Skip to content

Commit aaa743d

Browse files
Dan Carpenterrobclark
authored andcommitted
drm/msm/adreno: fix cast in adreno_get_param()
These casts need to happen before the shift. The only time it would matter would be if "rev.core" is >= 128. In that case the sign bit would be extended and we do not want that. Fixes: afab9d9 ("drm/msm/adreno: Expose speedbin to userspace") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Akhil P Oommen <quic_akhilpo@quicinc.com> Link: https://lore.kernel.org/r/20220307133105.GA17534@kili Signed-off-by: Rob Clark <robdclark@chromium.org>
1 parent 9225b33 commit aaa743d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/gpu/drm/msm/adreno/adreno_gpu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,10 @@ int adreno_get_param(struct msm_gpu *gpu, struct msm_file_private *ctx,
244244
*value = !adreno_is_a650_family(adreno_gpu) ? 0x100000 : 0;
245245
return 0;
246246
case MSM_PARAM_CHIP_ID:
247-
*value = (uint64_t) adreno_gpu->rev.patchid |
248-
(uint64_t) (adreno_gpu->rev.minor << 8) |
249-
(uint64_t) (adreno_gpu->rev.major << 16) |
250-
(uint64_t) (adreno_gpu->rev.core << 24);
247+
*value = (uint64_t)adreno_gpu->rev.patchid |
248+
((uint64_t)adreno_gpu->rev.minor << 8) |
249+
((uint64_t)adreno_gpu->rev.major << 16) |
250+
((uint64_t)adreno_gpu->rev.core << 24);
251251
if (!adreno_gpu->info->revn)
252252
*value |= ((uint64_t) adreno_gpu->speedbin) << 32;
253253
return 0;

0 commit comments

Comments
 (0)