2fdd468
From: Lyude Paul <lyude@redhat.com>
2fdd468
Date: Fri, 24 Apr 2020 15:07:22 -0400
2fdd468
Subject: drm/dp_mst: Fix drm_dp_send_dpcd_write() return code
2fdd468
2fdd468
drm_dp_mst_wait_tx_reply() returns > 1 if time elapsed in
2fdd468
wait_event_timeout() before check_txmsg_state(mgr, txmsg) evaluated to
2fdd468
true. However, we make the mistake of returning this time from
2fdd468
drm_dp_send_dpcd_write() on success instead of returning the number of
2fdd468
bytes written - causing spontaneous failures during link probing:
2fdd468
2fdd468
[drm:drm_dp_send_link_address [drm_kms_helper]] *ERROR* GUID check on
2fdd468
10:01 failed: 3975
2fdd468
2fdd468
Yikes! So, fix this by returning the number of bytes written on success
2fdd468
instead.
2fdd468
2fdd468
Signed-off-by: Lyude Paul <lyude@redhat.com>
2fdd468
Fixes: cb897542c6d2 ("drm/dp_mst: Fix W=1 warnings")
2fdd468
Cc: Benjamin Gaignard <benjamin.gaignard@st.com>
2fdd468
Cc: Sean Paul <sean@poorly.run>
2fdd468
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2fdd468
Reviewed-by: Sean Paul <sean@poorly.run>
2fdd468
Link: https://patchwork.freedesktop.org/patch/msgid/20200424190722.775284-1-lyude@redhat.com
2fdd468
---
2fdd468
 drivers/gpu/drm/drm_dp_mst_topology.c | 8 ++++++--
2fdd468
 1 file changed, 6 insertions(+), 2 deletions(-)
2fdd468
2fdd468
2fdd468
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
2fdd468
index 03a1496f6120..21dc78cb4ba6 100644
2fdd468
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
2fdd468
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
2fdd468
@@ -3436,8 +3436,12 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
2fdd468
 	drm_dp_queue_down_tx(mgr, txmsg);
2fdd468
 
2fdd468
 	ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
2fdd468
-	if (ret > 0 && txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
2fdd468
-		ret = -EIO;
2fdd468
+	if (ret > 0) {
2fdd468
+		if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
2fdd468
+			ret = -EIO;
2fdd468
+		else
2fdd468
+			ret = size;
2fdd468
+	}
2fdd468
 
2fdd468
 	kfree(txmsg);
2fdd468
 fail_put: