Skip to contentSkip to conversation

drm/gud: don't keep a connector without a CRTC as connector_state

PATCH In review Sajal Gupta 2 participants 2 messages Sep 22 – Oct 6

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/gud: don't keep a connector without a CRTC as connector_state

If the 'for_each_new_connector_in_state()' loop finishes without hitting the break, connector_state is left pointing at the last connector visited, which has no CRTC, instead of staying NULL.

That skips the "if (!connector_state)" fallback below the loop, which looks up the active connector when the state contains none. The function then carries on with a connector that is not driven.

Fix by resetting connector_state to NULL for each connector visited that has no CRTC, so that it is NULL when none was found and the fallback runs.

Fixes 40e1a70b4aed ("drm: Add GUD USB Display driver")
---
 drivers/gpu/drm/gud/gud_pipe.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/gud/gud_pipe.c +1 -0
index aa7792966287..5aa5ac2f3727 100644
@@ -507,6 +507,7 @@ int gud_plane_atomic_check(struct drm_plane *plane,
 	for_each_new_connector_in_state(state, connector, connector_state, i) {
 		if (connector_state->crtc)
 			break;
+		connector_state = NULL;
 	}
 
 	/*

--
2.55.0

maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Sajal Gupta

If the 'for_each_new_connector_in_state()' loop finishes without hitting the break, connector_state is left pointing at the last connector visited, which has no CRTC, instead of staying NULL.

That skips the "if (!connector_state)" fallback below the loop, which looks up the active connector when the state contains none. The function then carries on with a connector that is not driven.

Quoted 7 lines

Fix by resetting connector_state to NULL for each connector visited that has no CRTC, so that it is NULL when none was found and the fallback runs.

Fixes 40e1a70b4aed ("drm: Add GUD USB Display driver")
Quoted 18 lines
---
 drivers/gpu/drm/gud/gud_pipe.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/gud/gud_pipe.c +1 -1
index aa7792966287..5aa5ac2f3727 100644
@@ -507,6 +507,7 @@ int gud_plane_atomic_check(struct drm_plane *plane,
 	for_each_new_connector_in_state(state, connector, connector_state, i) {
 		if (connector_state->crtc)
 			break;
+		connector_state = NULL;
 	}
 
 	/*
--

2.55.0