[PATCH xserver 3/3] modesetting: Check crtc before searching link-status property

Daniel Martin consume.noise at gmail.com
Fri Oct 20 08:05:35 UTC 2017


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

Signed-off-by: Daniel Martin <consume.noise at gmail.com>
---
 hw/xfree86/drivers/modesetting/drmmode_display.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index e211e57eb..4906b0539 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -2270,12 +2270,14 @@ drmmode_handle_uevents(int fd, void *closure)
      */
     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 == NULL || drmmode_output->mode_output == NULL)
             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
@@ -2287,10 +2289,6 @@ drmmode_handle_uevents(int fd, void *closure)
             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);
-- 
2.13.6



More information about the xorg-devel mailing list