xf86-video-modesetting: 2 commits - src/driver.c src/drmmode_display.c

Maarten Lankhorst mlankhorst at kemper.freedesktop.org
Tue Mar 26 07:20:31 PDT 2013


 src/driver.c          |   28 ++++++++++++++++++++--------
 src/drmmode_display.c |    3 +++
 2 files changed, 23 insertions(+), 8 deletions(-)

New commits:
commit 3c631228a9f57e73ee693d5283894db1a460e0a4
Author: Maarten Lankhorst <maarten.lankhorst at canonical.com>
Date:   Tue Mar 26 15:19:52 2013 +0100

    modesetting: return null for get_modes if output could not be retrieved
    
    Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index e8ebef1..2dc7576 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -709,6 +709,9 @@ drmmode_output_get_modes(xf86OutputPtr output)
 	drmModePropertyPtr props;
 	xf86MonPtr mon = NULL;
 
+	if (!koutput)
+		return NULL;
+
 	/* look for an EDID property */
 	for (i = 0; i < koutput->count_props; i++) {
 		props = drmModeGetProperty(drmmode->fd, koutput->props[i]);
commit e5b5297ac449fb4ac62cc6471f933ae2265778a2
Author: Maarten Lankhorst <maarten.lankhorst at canonical.com>
Date:   Tue Mar 26 15:19:33 2013 +0100

    modesetting: clean up leaks
    
    Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>

diff --git a/src/driver.c b/src/driver.c
index 87ba272..06d6d53 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -206,7 +206,7 @@ static Bool probe_hw(char *dev)
     int fd = open_hw(dev);
     if (fd != -1) {
         close(fd);
-	return TRUE;
+        return TRUE;
     }
     return FALSE;
 }
@@ -530,15 +530,27 @@ static void msBlockHandler(BLOCKHANDLER_ARGS_DECL)
 static void
 FreeRec(ScrnInfoPtr pScrn)
 {
+    modesettingPtr ms;
+
     if (!pScrn)
-	return;
+        return;
 
-    if (!pScrn->driverPrivate)
-	return;
+    ms = modesettingPTR(pScrn);
+    if (!ms)
+        return;
+    pScrn->driverPrivate = NULL;
 
-    free(pScrn->driverPrivate);
+    if (ms->fd > 0) {
+        int ret;
+
+        if (ms->pEnt->location.type == BUS_PCI)
+            ret = drmClose(ms->fd);
+        else
+            ret = close(ms->fd);
+    }
+    free(ms->Options);
+    free(ms);
 
-    pScrn->driverPrivate = NULL;
 }
 
 static Bool
@@ -596,8 +608,8 @@ PreInit(ScrnInfoPtr pScrn, int flags)
 
 #if XSERVER_PLATFORM_BUS
     if (pEnt->location.type == BUS_PLATFORM) {
-            char *path = xf86_get_platform_device_attrib(pEnt->location.id.plat, ODEV_ATTRIB_PATH);
-            ms->fd = open_hw(path);
+        char *path = xf86_get_platform_device_attrib(pEnt->location.id.plat, ODEV_ATTRIB_PATH);
+        ms->fd = open_hw(path);
     }
     else 
 #endif


More information about the xorg-commit mailing list