BIT() takes a non-negative shift amount, but cpu_transcoder is of type
enum transcoder, which can in theory be INVALID_TRANSCODER (-1).

This is not a problem with the current implementation, because
cpu_transcoder is always valid when this code is reached, but it's
more robust to cast to unsigned so the shift is always well-defined.

Signed-off-by: Luca Coelho <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_ddi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c 
b/drivers/gpu/drm/i915/display/intel_ddi.c
index 86520848892e..c02c4d62c96e 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -4637,8 +4637,8 @@ static int intel_ddi_compute_config_late(struct 
intel_encoder *encoder,
 
        if (crtc_state->master_transcoder == crtc_state->cpu_transcoder) {
                crtc_state->master_transcoder = INVALID_TRANSCODER;
-               crtc_state->sync_mode_slaves_mask =
-                       port_sync_transcoders & 
~BIT(crtc_state->cpu_transcoder);
+               crtc_state->sync_mode_slaves_mask = port_sync_transcoders &
+                       ~BIT((unsigned int) crtc_state->cpu_transcoder);
        }
 
        return 0;
-- 
2.53.0

Reply via email to