drm/bridge: Fix improper bridge init order with pre_enable_prev_first
authorjsg <jsg@openbsd.org>
Sat, 15 Jun 2024 04:01:36 +0000 (04:01 +0000)
committerjsg <jsg@openbsd.org>
Sat, 15 Jun 2024 04:01:36 +0000 (04:01 +0000)
From Jagan Teki
45755ef11f0337110105d4a6a2cd6bdc278dffa0 in linux-6.6.y/6.6.33
e18aeeda0b6905c333df5a0566b99f5c84426098 in mainline linux

sys/dev/pci/drm/drm_bridge.c

index ce49062..e02c292 100644 (file)
@@ -694,11 +694,17 @@ void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge,
                                 */
                                list_for_each_entry_from(next, &encoder->bridge_chain,
                                                         chain_node) {
-                                       if (next->pre_enable_prev_first) {
+                                       if (!next->pre_enable_prev_first) {
                                                next = list_prev_entry(next, chain_node);
                                                limit = next;
                                                break;
                                        }
+
+                                       if (list_is_last(&next->chain_node,
+                                                        &encoder->bridge_chain)) {
+                                               limit = next;
+                                               break;
+                                       }
                                }
 
                                /* Call these bridges in reverse order */
@@ -781,7 +787,7 @@ void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge,
                                        /* Found first bridge that does NOT
                                         * request prev to be enabled first
                                         */
-                                       limit = list_prev_entry(next, chain_node);
+                                       limit = next;
                                        break;
                                }
                        }