[Openchrome-devel] xf86-video-openchrome: src/via_outputs.c

Kevin Brace kevinbrace at kemper.freedesktop.org
Tue Feb 9 21:19:50 UTC 2016


 src/via_outputs.c |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 6964b889d77422ed16972b0ba849d9d5c6574daa
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Tue Feb 9 13:10:51 2016 -0800

    Fixing DVI detection code crash
    
    The portion of the code responsible for detecting VT1632A external TMDS
    transmitter for DVI was causing a crash if VT1632A was not detected on
    I2C buses. This was happening due to xf86DestroyI2CDevRec being called
    prior to the call to xf86I2CDevInit if VT1632A was not detected. Now the
    code will probe I2C buses using xf86I2CProbeAddress to look for VT1632A,
    and if VT1632A is not detected, it will stop trying to detect VT1632A
    via I2C buses.
    
    Signed-off-by: Kyle Guinn <elyk03 at gmail.com>
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_outputs.c b/src/via_outputs.c
index c661a4f..d20669a 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -1006,28 +1006,28 @@ via_dvi_init(ScrnInfoPtr pScrn)
     struct ViaVT1632PrivateData *private_data = NULL;
     I2CBusPtr pBus = NULL;
     I2CDevPtr pDev = NULL;
+    I2CSlaveAddr addr = 0x10;
 
     if (!pVia->pI2CBus2 || !pVia->pI2CBus3) {
         return;
     }
 
-    pDev = xf86CreateI2CDevRec();
-    if (!pDev) {
+    if (xf86I2CProbeAddress(pVia->pI2CBus3, addr)) {
+        pBus = pVia->pI2CBus3;
+    } else if (xf86I2CProbeAddress(pVia->pI2CBus2, addr)) {
+        pBus = pVia->pI2CBus2;
+    } else {
         return;
     }
 
-    pDev->DevName = "VT1632";
-    pDev->SlaveAddr = 0x10;
-
-    if (xf86I2CProbeAddress(pVia->pI2CBus3, pDev->SlaveAddr)) {
-        pDev->pI2CBus = pVia->pI2CBus3;
-    } else if (xf86I2CProbeAddress(pVia->pI2CBus2, pDev->SlaveAddr)) {
-        pDev->pI2CBus = pVia->pI2CBus2;
-    } else {
-        xf86DestroyI2CDevRec(pDev, TRUE);
+    pDev = xf86CreateI2CDevRec();
+    if (!pDev) {
         return;
     }
 
+    pDev->DevName = "VT1632A";
+    pDev->SlaveAddr = addr;
+    pDev->pI2CBus = pBus;
     if (!xf86I2CDevInit(pDev)) {
         xf86DestroyI2CDevRec(pDev, TRUE);
         return;


More information about the Openchrome-devel mailing list