drm_hwcomposer: Don't try to get configs for a disconnected connector
Short circuit getting the configs for connectors which are disconnected.
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Change-Id: Ieabbf08f4d4a6c8b03f948399113e3ad04a2d93a
diff --git a/hwcomposer.cpp b/hwcomposer.cpp
index b6df190..ecbcd29 100644
--- a/hwcomposer.cpp
+++ b/hwcomposer.cpp
@@ -721,8 +721,15 @@
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));