[PATCH][next] drm/amd/display: fix unsigned less than 0 comparison on error check
From: Colin King
Date: Fri Nov 08 2019 - 10:00:24 EST
From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
Currently the error check on the call to drm_dp_atomic_find_vcpi_slots
is always false because an unsigned dm_new_connector_state->vcpi_slots
is being checked for a less than zero. Fix this by casting this to
an int on the comparison.
Addresses-Coverity: ("Unsigned compared against 0")
Fixes: 5133c6241d9c ("drm/amd/display: Add MST atomic routines")
Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 37c56156a116..00e730b8d98f 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4866,7 +4866,7 @@ static int dm_encoder_helper_atomic_check(struct drm_encoder *encoder,
mst_mgr,
mst_port,
dm_new_connector_state->pbn);
- if (dm_new_connector_state->vcpi_slots < 0) {
+ if ((int)dm_new_connector_state->vcpi_slots < 0) {
DRM_DEBUG_ATOMIC("failed finding vcpi slots: %d\n", (int)dm_new_connector_state->vcpi_slots);
return dm_new_connector_state->vcpi_slots;
}
--
2.20.1