summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-09-26 19:30:17 -0300
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-09-26 19:30:17 -0300
commit314eecb6628840a942ff2e76d8c7402301feac77 (patch)
tree93cb70d5fc5bd91ed2baec8672f10ae2699068b3 /src
parentf18222ffcff8e78b3cfcd220cad06a1daa3fc920 (diff)
Properly check pScrn->driverPrivate before deferencing it.
Add missing divide by 1000 in smi_501.c, as well as a FIXME comment about a crash, and possible cause as well as possible ways to program other clocks.
Diffstat (limited to 'src')
-rw-r--r--src/smi_501.c6
-rw-r--r--src/smi_driver.c16
2 files changed, 9 insertions, 13 deletions
diff --git a/src/smi_501.c b/src/smi_501.c
index 973e33f..273e6ab 100644
--- a/src/smi_501.c
+++ b/src/smi_501.c
@@ -244,7 +244,7 @@ xf86ModeBandwidth(DisplayModePtr mode, int depth)
active_percent = a_active / a_total;
pixels_per_second = active_percent * mode->Clock * 1000.0;
- return ((double)(pixels_per_second * bytes_per_pixel));
+ return ((double)(pixels_per_second * bytes_per_pixel) / 1000.0);
}
#endif
@@ -300,6 +300,10 @@ SMI501_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr xf86mode)
field(mode->clock, m_divider) = 1;
field(mode->clock, m_shift) = 0;
+ /* FIXME probably should not "touch" m2clk. A value other then 112Mhz
+ * will instant lock on my test prototype, "or" maybe it just means
+ * that m2clk value must be equal to mclk value? (and mclk must be
+ * set first!?) */
switch (pSmi->MCLK) {
case 168000: /* 336/1/1 */
field(mode->clock, m2_select) = 1;
diff --git a/src/smi_driver.c b/src/smi_driver.c
index 507e6c7..a1e5dc4 100644
--- a/src/smi_driver.c
+++ b/src/smi_driver.c
@@ -418,19 +418,11 @@ SMI_FreeRec(ScrnInfoPtr pScrn)
ENTER();
- if (pScrn->driverPrivate != NULL) {
- xfree(pScrn->driverPrivate);
- pScrn->driverPrivate = NULL;
- }
-
- if (pSmi->save) {
+ if (pSmi) {
xfree(pSmi->save);
- pSmi->save = NULL;
- }
-
- if (pSmi->mode) {
xfree(pSmi->mode);
- pSmi->mode = NULL;
+ xfree(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
}
LEAVE();
@@ -1054,7 +1046,7 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
clockRanges->clockIndex = -1;
clockRanges->interlaceAllowed = FALSE;
clockRanges->doubleScanAllowed = FALSE;
-
+
i = xf86ValidateModes(
pScrn, /* Screen pointer */
pScrn->monitor->Modes, /* Available monitor modes */