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

Kevin Brace kevinbrace at kemper.freedesktop.org
Sun Mar 6 03:50:37 UTC 2016


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

New commits:
commit 802544370dd827ed3488965e39804e3cb630888a
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Sat Mar 5 19:48:33 2016 -0800

    Checking the validity of I2C buses before initializing VGA output
    
    The validity of I2C buses is checked before VGA output is registered
    with X Server.
    
    Reported-by: Christopher Havel <laserhawk64 at gmail.com>
    Tested-by: Justin Chevrier <jchevrier 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 31013a4..d97d585 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -913,16 +913,22 @@ via_analog_init(ScrnInfoPtr pScrn)
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Entered via_analog_init.\n"));
 
-    if (pVia->pI2CBus1) {
-        output = xf86OutputCreate(pScrn, &via_analog_funcs, "VGA-1");
-
-        output->possible_crtcs = 0x3;
-        output->possible_clones = 0;
-        output->interlaceAllowed = TRUE;
-        output->doubleScanAllowed = FALSE;
-        pBIOSInfo->analog = output;
+    if (!pVia->pI2CBus1 || !pVia->pI2CBus2) {
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                    "I2C Bus 1 or I2C Bus 2 does not exist.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting via_analog_init.\n"));
+        return;
     }
 
+    output = xf86OutputCreate(pScrn, &via_analog_funcs, "VGA-1");
+
+    output->possible_crtcs = 0x3;
+    output->possible_clones = 0;
+    output->interlaceAllowed = TRUE;
+    output->doubleScanAllowed = FALSE;
+    pBIOSInfo->analog = output;
+
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Exiting via_analog_init.\n"));
 }


More information about the Openchrome-devel mailing list