OSDN Git Service

drm_hwcomposer: Don't try to get configs for a disconnected connector
authorSean Paul <seanpaul@chromium.org>
Wed, 4 Feb 2015 18:08:00 +0000 (10:08 -0800)
committerSean Paul <seanpaul@google.com>
Wed, 4 Feb 2015 22:46:27 +0000 (14:46 -0800)
Short circuit getting the configs for connectors which are disconnected.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Change-Id: Ieabbf08f4d4a6c8b03f948399113e3ad04a2d93a

hwcomposer.cpp

index b6df190..ecbcd29 100644 (file)
@@ -721,8 +721,15 @@ static int hwc_get_display_configs(struct hwc_composer_device_1* dev,
                return -ENODEV;
        }
 
-       if (hd->configs)
+       if (hd->configs) {
                free(hd->configs);
+               hd->configs = NULL;
+       }
+
+       if (c->connection == DRM_MODE_DISCONNECTED) {
+               ret = -ENODEV;
+               goto out;
+       }
 
        hd->configs = (drmModeModeInfoPtr)calloc(c->count_modes,
                                        sizeof(*hd->configs));