summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2011-03-29 11:18:24 +0200
committerThomas Hellstrom <thellstrom@vmware.com>2011-03-30 10:52:19 +0200
commitb234d7d6925b480a9c4fe23e5100e6fe7e5c0eac (patch)
treecb5b6bde396979a24905238319da4093b4efcb75
parentcdb04224db69a6b3beb66c99879e20917b8b0fb2 (diff)
vmwlegacy: Silence a number of warnings
This potentially also fixes a use of an uninitialized pointer value, which may cause OOM or segfaults. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Michel Dänzer <daenzer@vmware.com>
-rw-r--r--src/vmware.c9
-rw-r--r--src/vmwaremodes.c51
2 files changed, 10 insertions, 50 deletions
diff --git a/src/vmware.c b/src/vmware.c
index e04835f..1f262e3 100644
--- a/src/vmware.c
+++ b/src/vmware.c
@@ -1021,6 +1021,7 @@ VMWAREMapMem(ScrnInfoPtr pScrn)
#if XSERVER_LIBPCIACCESS
int err;
struct pci_device *const device = pVMWARE->PciInfo;
+ void *fbBase;
#endif
#if XSERVER_LIBPCIACCESS
@@ -1028,14 +1029,14 @@ VMWAREMapMem(ScrnInfoPtr pScrn)
pVMWARE->memPhysBase,
pVMWARE->videoRam,
PCI_DEV_MAP_FLAG_WRITABLE,
- (void **) &pVMWARE->FbBase);
+ &fbBase);
if (err) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Unable to map frame buffer BAR. %s (%d)\n",
strerror (err), err);
return FALSE;
}
-
+ pVMWARE->FbBase = fbBase;
#else
pVMWARE->FbBase = xf86MapPciMem(pScrn->scrnIndex, 0,
pVMWARE->PciTag,
@@ -1336,6 +1337,7 @@ VMWAREInitFIFO(ScrnInfoPtr pScrn)
#if XSERVER_LIBPCIACCESS
struct pci_device *const device = pVMWARE->PciInfo;
int err;
+ void *mmioVirtBase;
#endif
CARD32* vmwareFIFO;
Bool extendedFifo;
@@ -1349,13 +1351,14 @@ VMWAREInitFIFO(ScrnInfoPtr pScrn)
err = pci_device_map_range(device, pVMWARE->mmioPhysBase,
pVMWARE->mmioSize,
PCI_DEV_MAP_FLAG_WRITABLE,
- (void **) &pVMWARE->mmioVirtBase);
+ &mmioVirtBase);
if (err) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Unable to map mmio BAR. %s (%d)\n",
strerror (err), err);
return;
}
+ pVMWARE->mmioVirtBase = mmioVirtBase;
#else
pVMWARE->mmioVirtBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
pVMWARE->PciTag,
diff --git a/src/vmwaremodes.c b/src/vmwaremodes.c
index d82eba6..5386b17 100644
--- a/src/vmwaremodes.c
+++ b/src/vmwaremodes.c
@@ -50,50 +50,6 @@
#define VMW_DEFLT_MODE_NAME "vmwlegacy-default-%dx%d"
/*
- * Most of the modelines copied from DMTModes table of xf86EdidModes.c.
- * For those modes not in DMTModes table are generated by gtf
- * These modes are not used currently, and not really necessary.
- * Consider removing them in a future release.
- */
-static DisplayModeRec VMwareModes[] = {
- /* 4:3 modes */
- { MODEPREFIX, 5260, 320, 304, 336, 352, 0, 240, 241, 244, 249, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 320x240@60Hz, GTF */
- { MODEPREFIX, 8660, 400, 392, 432, 464, 0, 300, 301, 304, 311, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 400x300@60Hz, GTF */
- { MODEPREFIX, 14900, 512, 520, 568, 624, 0, 384, 385, 388, 398, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 512x384@60Hz, GTF */
- { MODEPREFIX, 25175, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz, DMT */
- { MODEPREFIX, 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz, DMT */
- { MODEPREFIX, 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz, DMT */
- { MODEPREFIX, 81620, 1152, 1216, 1336, 1520, 0, 864, 865, 868, 895, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1152x864@60Hz, GTF */
- { MODEPREFIX,108000, 1280, 1376, 1488, 1800, 0, 960, 961, 964, 1000, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x960@60Hz, DMT */
- { MODEPREFIX,121750, 1400, 1488, 1632, 1864, 0, 1050, 1053, 1057, 1089, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1400x1050@60Hz,DMT */
- { MODEPREFIX,162000, 1600, 1664, 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1600x1200@60Hz,DMT */
- { MODEPREFIX,234000, 1920, 2048, 2256, 2600, 0, 1440, 1441, 1444, 1500, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1920x1440@60Hz,DMT */
- { MODEPREFIX,266950, 2048, 2200, 2424, 2800, 0, 1536, 1537, 1540, 1589, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 2048x1536@60Hz,GTF */
- { MODEPREFIX,421560, 2560, 2768, 3048, 3536, 0, 1920, 1921, 1924, 1987, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 2560x1920@60Hz,GTF */
- /* 16:9 modes */
- { MODEPREFIX, 31730, 856, 872, 960, 1064, 0, 480, 481, 484, 497, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 856x480@60Hz, GTF */
- { MODEPREFIX, 74480, 1280, 1336, 1472, 1664, 0, 720, 721, 724, 746, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x720@60Hz, GTF */
- { MODEPREFIX, 85860, 1368, 1440, 1584, 1800, 0, 768, 769, 772, 795, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1368x768@60Hz, GTF */
- { MODEPREFIX,172800, 1920, 2040, 2248, 2576, 0, 1080, 1081, 1084, 1118, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1920x1080@60Hz,GTF */
- /* 16:10 modes */
- { MODEPREFIX, 83500, 1280, 1352, 1480, 1680, 0, 800, 803, 809, 831, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x800@60Hz, DMT */
- { MODEPREFIX,106500, 1440, 1520, 1672, 1904, 0, 900, 903, 909, 934, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1440x900@60Hz, DMT */
- { MODEPREFIX,146250, 1680, 1784, 1960, 2240, 0, 1050, 1053, 1059, 1089, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1680x1050@60Hz,DMT */
- { MODEPREFIX,193250, 1920, 2056, 2256, 2592, 0, 1200, 1203, 1209, 1245, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1920x1200@60Hz,DMT */
- { MODEPREFIX,348500, 2560, 2752, 3032, 3504, 0, 1600, 1603, 1609, 1658, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 2560x1600@60Hz,DMT */
- /* DVD modes */
- { MODEPREFIX, 26720, 720, 736, 808, 896, 0, 480, 481, 484, 497, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x480@60Hz, GTF */
- { MODEPREFIX, 32670, 720, 744, 816, 912, 0, 576, 577, 580, 597, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x576@60Hz, GTF */
- /* Odd modes */
- { MODEPREFIX, 4190, 320, 304, 328, 336, 0, 200, 201, 204, 208, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 320x200@60Hz, GTF */
- { MODEPREFIX, 19520, 640, 648, 712, 784, 0, 400, 401, 404, 415, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 640x400@60Hz, GTF */
- { MODEPREFIX, 29580, 800, 816, 896, 992, 0, 480, 481, 484, 497, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x480@60Hz, GTF */
- { MODEPREFIX, 79500, 1280, 1344, 1472, 1664, 0, 768, 771, 778, 798, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x768@60Hz, DMT */
- { MODEPREFIX,108000, 1280, 1328, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@60Hz,DMT */
-};
-
-
-/*
*-----------------------------------------------------------------------------
*
* vmwareAddDefaultMode --
@@ -112,7 +68,6 @@ static DisplayModeRec VMwareModes[] = {
void
vmwareAddDefaultMode(ScrnInfoPtr pScrn, uint32 dwidth, uint32 dheight)
{
- MonPtr monitor = pScrn->monitor;
DisplayModePtr *monitorModes = &pScrn->monitor->Modes;
DisplayModePtr modes = NULL;
@@ -122,10 +77,10 @@ vmwareAddDefaultMode(ScrnInfoPtr pScrn, uint32 dwidth, uint32 dheight)
#ifdef HAVE_XORG_SERVER_1_2_0
if (dwidth && dheight) {
+ MonPtr monitor = pScrn->monitor;
DisplayModePtr mode = NULL;
DisplayModeRec dynamic =
{ MODEPREFIX, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MODESUFFIX };
- int i = 0;
unsigned dispModeCount = 0;
char **dispModeList;
char *dynModeName;
@@ -145,9 +100,9 @@ vmwareAddDefaultMode(ScrnInfoPtr pScrn, uint32 dwidth, uint32 dheight)
dispModeList = pScrn->display->modes;
while(*dispModeList)
dispModeList++;
+ dispModeCount = dispModeList - pScrn->display->modes;
}
- dispModeCount = dispModeList - pScrn->display->modes;
dispModeList = xnfcalloc(dispModeCount + 2, sizeof(*dispModeList));
if (!dispModeList)
goto out_err;
@@ -183,6 +138,8 @@ vmwareAddDefaultMode(ScrnInfoPtr pScrn, uint32 dwidth, uint32 dheight)
}
*monitorModes = xf86ModesAdd(*monitorModes, modes);
+#else
+ (void) modes;
#endif
return;
out_err: