Skip to contentSkip to conversation

drm/nouveau/disp: Revert a NULL check inside nouveau_connector_get_modes

PATCH In review Karol Herbst 2 participants 2 messages Aug 5, 2023 – Aug 7, 2023

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

PATCH 1/1 drm/nouveau/disp: Revert a NULL check inside nouveau_connector_get_modes

The original commit adding that check tried to protect the kenrel against a potential invalid NULL pointer access.

However we call nouveau_connector_detect_depth once without a native_mode set on purpose for non LVDS connectors and this broke DP support in a few cases.

Cc Olaf Skibbe <[email protected]>
Cc Lyude Paul <[email protected]>
Fixes 20a2ce87fbaf8 ("drm/nouveau/dp: check for NULL nv_connector->native_mode")
---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_connector.c +1 -1
index f75c6f09dd2af..a2e0033e8a260 100644
@@ -967,7 +967,7 @@ nouveau_connector_get_modes(struct drm_connector *connector)
 	/* Determine display colour depth for everything except LVDS now,
 	 * DP requires this before mode_valid() is called.
 	 */
-	if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS && nv_connector->native_mode)
+	if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS)
 		nouveau_connector_detect_depth(connector);
 
 	/* Find the native mode if this is a digital panel, if we didn't
Signature · 1 line
2.41.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Ugh, thanks for catching this!

Quoted 30 lines · Karol Herbst

The original commit adding that check tried to protect the kenrel against a potential invalid NULL pointer access.

However we call nouveau_connector_detect_depth once without a native_mode set on purpose for non LVDS connectors and this broke DP support in a few cases.

Cc Olaf Skibbe <[email protected]>
Cc Lyude Paul <[email protected]>
Fixes 20a2ce87fbaf8 ("drm/nouveau/dp: check for NULL nv_connector->native_mode")
---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_connector.c +1 -1
index f75c6f09dd2af..a2e0033e8a260 100644
@@ -967,7 +967,7 @@ nouveau_connector_get_modes(struct drm_connector *connector)
 	/* Determine display colour depth for everything except LVDS now,
 	 * DP requires this before mode_valid() is called.
 	 */
-	if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS && nv_connector->native_mode)
+	if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS)
 		nouveau_connector_detect_depth(connector);
 
 	/* Find the native mode if this is a digital panel, if we didn't
Signature · 3 lines
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat