Skip to contentSkip to conversation

drm/dp_mst: Fix drm_dp_send_dpcd_write() return code

PATCH In review Lyude Paul 3 participants 3 messages Apr 24, 2020 – Apr 27, 2020

Subsystems (2)
lore
Share & tools
lore

Lyude Paul

author
#0 lore raw

PATCH 1/1 drm/dp_mst: Fix drm_dp_send_dpcd_write() return code

drm_dp_mst_wait_tx_reply() returns > 1 if time elapsed in wait_event_timeout() before check_txmsg_state(mgr, txmsg) evaluated to true. However, we make the mistake of returning this time from drm_dp_send_dpcd_write() on success instead of returning the number of bytes written - causing spontaneous failures during link probing:

[drm:drm_dp_send_link_address [drm_kms_helper]] *ERROR* GUID check on 10:01 failed: 3975

Yikes! So, fix this by returning the number of bytes written on success instead.

Fixes cb897542c6d2 ("drm/dp_mst: Fix W=1 warnings")
Cc Benjamin Gaignard <[email protected]>
Cc Sean Paul <[email protected]>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +6 -2
index 03a1496f6120..21dc78cb4ba6 100644
@@ -3436,8 +3436,12 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
 	drm_dp_queue_down_tx(mgr, txmsg);
 
 	ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
-	if (ret > 0 && txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
-		ret = -EIO;
+	if (ret > 0) {
+		if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
+			ret = -EIO;
+		else
+			ret = size;
+	}
 
 	kfree(txmsg);
 fail_put:
Signature · 1 line
2.25.3
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Lyude Paul

drm_dp_mst_wait_tx_reply() returns > 1 if time elapsed in wait_event_timeout() before check_txmsg_state(mgr, txmsg) evaluated to true. However, we make the mistake of returning this time from drm_dp_send_dpcd_write() on success instead of returning the number of bytes written - causing spontaneous failures during link probing:

[drm:drm_dp_send_link_address [drm_kms_helper]] *ERROR* GUID check on 10:01 failed: 3975

Quoted 7 lines

Yikes! So, fix this by returning the number of bytes written on success instead.

Fixes cb897542c6d2 ("drm/dp_mst: Fix W=1 warnings")
Cc Benjamin Gaignard <[email protected]>
Cc Sean Paul <[email protected]>
Quoted 26 lines
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +6 -3
index 03a1496f6120..21dc78cb4ba6 100644
@@ -3436,8 +3436,12 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
        drm_dp_queue_down_tx(mgr, txmsg);
 
        ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
-       if (ret > 0 && txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
-               ret = -EIO;
+       if (ret > 0) {
+               if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
+                       ret = -EIO;
+               else
+                       ret = size;
+       }
 
        kfree(txmsg);
 fail_put:
--

2.25.3

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v1 1/1
#2 lore raw
In reply to Lyude Paul
Quoted 10 lines · Lyude Paul

drm_dp_mst_wait_tx_reply() returns > 1 if time elapsed in wait_event_timeout() before check_txmsg_state(mgr, txmsg) evaluated to true. However, we make the mistake of returning this time from drm_dp_send_dpcd_write() on success instead of returning the number of bytes written - causing spontaneous failures during link probing:

[drm:drm_dp_send_link_address [drm_kms_helper]] *ERROR* GUID check on 10:01 failed: 3975

Quoted 7 lines

Yikes! So, fix this by returning the number of bytes written on success instead.

Fixes cb897542c6d2 ("drm/dp_mst: Fix W=1 warnings")
Cc Benjamin Gaignard <[email protected]>
Cc Sean Paul <[email protected]>
Quoted 24 lines
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +6 -3
index 03a1496f6120..21dc78cb4ba6 100644
@@ -3436,8 +3436,12 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
        drm_dp_queue_down_tx(mgr, txmsg);
 
        ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
-       if (ret > 0 && txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
-               ret = -EIO;
+       if (ret > 0) {
+               if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
+                       ret = -EIO;
+               else
+                       ret = size;
+       }
 
        kfree(txmsg);
 fail_put:
--
Quoted 2 lines

2.25.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel