summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mga_driver.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/mga_driver.c b/src/mga_driver.c
index 1a72e76..4f86b9c 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -129,8 +129,14 @@ static void MGAFreeScreen(int scrnIndex, int flags);
static ModeStatus MGAValidMode(int scrnIndex, DisplayModePtr mode,
Bool verbose, int flags);
+#if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ >= 4)
+#define __must_check __attribute__((warn_unused_result))
+#else
+#define __must_check /* */
+#endif
+
/* Internally used functions */
-static Bool MGAMapMem(ScrnInfoPtr pScrn);
+static Bool __must_check MGAMapMem(ScrnInfoPtr pScrn);
static Bool MGAUnmapMem(ScrnInfoPtr pScrn);
static void MGASave(ScrnInfoPtr pScrn);
static void MGARestore(ScrnInfoPtr pScrn);
@@ -820,7 +826,10 @@ MGACountRam(ScrnInfoPtr pScrn)
int i;
pMga->FbMapSize = ProbeSize * 1024;
- MGAMapMem(pScrn);
+ if (!MGAMapMem(pScrn)) {
+ return 0;
+ }
+
base = pMga->FbBase;
/* turn MGA mode on - enable linear frame buffer (CRTCEXT3) */
@@ -1796,6 +1805,12 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
pScrn->videoRam = MGACountRam(pScrn);
}
+ if (pScrn->videoRam == 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Unable to detect video RAM.\n");
+ return FALSE;
+ }
+
if (pMga->DualHeadEnabled) {
/* This takes gives either half or 8 meg to the second head
* whichever is less. */