Skip to contentSkip to conversation

drm/vc4: Fix bitwise OR versus ternary operator in vc4_plane_mode_set

PATCH Applied Nathan Chancellor 2 participants 2 messages Sep 10, 2020 – Sep 11, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vc4: Fix bitwise OR versus ternary operator in vc4_plane_mode_set

Clang warns:

drivers/gpu/drm/vc4/vc4_plane.c:901:27: warning: operator '?:' has lower precedence than '|'; '|' will be evaluated first [-Wbitwise-conditional-parentheses]

                                fb->format->has_alpha ?
                                ~~~~~~~~~~~~~~~~~~~~~ ^
drivers/gpu/drm/vc4/vc4_plane.c:901:27: note: place parentheses around
the '|' expression to silence this warning
                                fb->format->has_alpha ?
                                ~~~~~~~~~~~~~~~~~~~~~ ^
drivers/gpu/drm/vc4/vc4_plane.c:901:27: note: place parentheses around
the '?:' expression to evaluate it first
                                fb->format->has_alpha ?
                                ~~~~~~~~~~~~~~~~~~~~~~^

1 warning generated.

Add the parentheses as that was clearly intended, otherwise SCALER5_CTL2_ALPHA_PREMULT won't be added to the list.

Fixes c54619b0bfb3 ("drm/vc4: Add support for the BCM2711 HVS5")
---
 drivers/gpu/drm/vc4/vc4_plane.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vc4/vc4_plane.c +2 -2
index 24d7e6db6fdd..89543fa8ca4d 100644
@@ -898,8 +898,8 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
 		vc4_dlist_write(vc4_state,
 				VC4_SET_FIELD(state->alpha >> 4,
 					      SCALER5_CTL2_ALPHA) |
-				fb->format->has_alpha ?
-					SCALER5_CTL2_ALPHA_PREMULT : 0 |
+				(fb->format->has_alpha ?
+					SCALER5_CTL2_ALPHA_PREMULT : 0) |
 				(mix_plane_alpha ?
 					SCALER5_CTL2_ALPHA_MIX : 0) |
 				VC4_SET_FIELD(fb->format->has_alpha ?

base-commit: 8c3c818c23a5bbce6ff180dd2ee04415241df77c

Signature · 1 line
2.28.0
#1 lore raw
Quoted 15 lines · Nathan Chancellor

Clang warns:

drivers/gpu/drm/vc4/vc4_plane.c:901:27: warning: operator '?:' has lower precedence than '|'; '|' will be evaluated first [-Wbitwise-conditional-parentheses]

                                fb->format->has_alpha ?
                                ~~~~~~~~~~~~~~~~~~~~~ ^
drivers/gpu/drm/vc4/vc4_plane.c:901:27: note: place parentheses around
the '|' expression to silence this warning
                                fb->format->has_alpha ?
                                ~~~~~~~~~~~~~~~~~~~~~ ^
drivers/gpu/drm/vc4/vc4_plane.c:901:27: note: place parentheses around
the '?:' expression to evaluate it first
                                fb->format->has_alpha ?
                                ~~~~~~~~~~~~~~~~~~~~~~^
Quoted 8 lines

1 warning generated.

Add the parentheses as that was clearly intended, otherwise SCALER5_CTL2_ALPHA_PREMULT won't be added to the list.

Fixes c54619b0bfb3 ("drm/vc4: Add support for the BCM2711 HVS5")

Applied, thanks!
Maxime