Skip to contentSkip to conversation

drm/dp_mst: Correct the bug in drm_dp_update_payload_part1()

PATCH In review Wayne Lin 2 participants 2 messages Dec 3, 2019 – Dec 4, 2019

Subsystems (2)
lore
Share & tools
lore

Wayne Lin

author
#0 lore raw

PATCH v2 1/1 drm/dp_mst: Correct the bug in drm_dp_update_payload_part1()

[Why]
If the payload_state is DP_PAYLOAD_DELETE_LOCAL in series, current code doesn't delete the payload at current index and just move the index to next one after shuffling payloads.

[How]
Drop the i++ increasing part in for loop head and decide whether to increase the index or not according to payload_state of current payload.

Changes since v1:
* Refine the code to have it easy reading
* Amend the commit message to meet the way code is modified now.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +4 -2
index 81e92b260d7a..4ef6decc0551 100644
@@ -3176,9 +3176,11 @@ int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr)
 			drm_dp_mst_topology_put_port(port);
 	}
 
-	for (i = 0; i < mgr->max_payloads; i++) {
-		if (mgr->payloads[i].payload_state != DP_PAYLOAD_DELETE_LOCAL)
+	for (i = 0; i < mgr->max_payloads; /* do nothing */) {
+		if (mgr->payloads[i].payload_state != DP_PAYLOAD_DELETE_LOCAL) {
+			i++;
 			continue;
+		}
 
 		DRM_DEBUG_KMS("removing payload %d\n", i);
 		for (j = i; j < mgr->max_payloads - 1; j++) {
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw

Just pushed to drm-misc-next-fixes as
e5a6ca27eb72c67533ddfc11c06df84beaa167fa, thanks!

Quoted 41 lines · Wayne Lin

[Why]
If the payload_state is DP_PAYLOAD_DELETE_LOCAL in series, current code doesn't delete the payload at current index and just move the index to next one after shuffling payloads.

[How]
Drop the i++ increasing part in for loop head and decide whether to increase the index or not according to payload_state of current payload.

Changes since v1:
* Refine the code to have it easy reading
* Amend the commit message to meet the way code is modified now.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +4 -2
index 81e92b260d7a..4ef6decc0551 100644
@@ -3176,9 +3176,11 @@ int drm_dp_update_payload_part1(struct
 drm_dp_mst_topology_mgr *mgr)
 			drm_dp_mst_topology_put_port(port);
 	}
 
-	for (i = 0; i < mgr->max_payloads; i++) {
-		if (mgr->payloads[i].payload_state != DP_PAYLOAD_DELETE_LOCAL)
+	for (i = 0; i < mgr->max_payloads; /* do nothing */) {
+		if (mgr->payloads[i].payload_state != DP_PAYLOAD_DELETE_LOCAL)
 {
+			i++;
 			continue;
+		}
 
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
 		DRM_DEBUG_KMS("removing payload %d\n", i);
 		for (j = i; j < mgr->max_payloads - 1; j++) {
Signature · 7 lines
Cheers,
	Lyude Paul

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