Skip to contentSkip to conversation

modesetting: Check crtc before searching link-status property

PATCH New Michel Dänzer 1 participant 1 message Nov 1, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 modesetting: Check crtc before searching link-status property

From: Daniel Martin <[email protected]>

No need to lookup the link-status property if we don't have a crtc.

(Ported from xserver commit 8d7f7e24261e68459e6f0a865e243473f65fe7ad)

---
 src/drmmode_display.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
src/drmmode_display.c +3 -5
index 4ca94e71d..55551eea7 100644
@@ -2599,12 +2599,14 @@ amdgpu_mode_hotplug(ScrnInfoPtr scrn, drmmode_ptr drmmode)
 	 */
 	for (i = 0; i < config->num_output; i++) {
 		xf86OutputPtr output = config->output[i];
+		xf86CrtcPtr crtc = output->crtc;
 		drmmode_output_private_ptr drmmode_output = output->driver_private;
 		uint32_t con_id;
 		drmModeConnectorPtr koutput;
 
-		if (drmmode_output->mode_output == NULL)
+		if (!crtc || !drmmode_output->mode_output)
 			continue;
+
 		con_id = drmmode_output->mode_output->connector_id;
 		/* Get an updated view of the properties for the current connector and
 		 * look for the link-status property
@@ -2616,10 +2618,6 @@ amdgpu_mode_hotplug(ScrnInfoPtr scrn, drmmode_ptr drmmode)
 			if (props && props->flags & DRM_MODE_PROP_ENUM &&
 			    !strcmp(props->name, "link-status") &&
 			    koutput->prop_values[j] == DRM_MODE_LINK_STATUS_BAD) {
-				xf86CrtcPtr crtc = output->crtc;
-				if (!crtc)
-					continue;
-
 				/* the connector got a link failure, re-set the current mode */
 				drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation,
 						       crtc->x, crtc->y);
Signature · 6 lines
2.15.0.rc2

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