summaryrefslogtreecommitdiffstats
path: root/drivers/staging/xgifb
diff options
context:
space:
mode:
authorAaro Koskinen2012-04-07 00:13:48 +0200
committerGreg Kroah-Hartman2012-04-10 18:55:09 +0200
commit051ff1bb3cb30e5e94d402fe5c9c1fdf4f9cd24c (patch)
tree79d98e9a2655c25137bb744bbd9db8b55dd52728 /drivers/staging/xgifb
parentstaging: xgifb: XGIfb_mode_rate_to_ddata: delete commented-out code (diff)
downloadkernel-qcow2-linux-051ff1bb3cb30e5e94d402fe5c9c1fdf4f9cd24c.tar.gz
kernel-qcow2-linux-051ff1bb3cb30e5e94d402fe5c9c1fdf4f9cd24c.tar.xz
kernel-qcow2-linux-051ff1bb3cb30e5e94d402fe5c9c1fdf4f9cd24c.zip
staging: xgifb: XGIfb_mode_rate_to_ddata: initialize ModeIdIndex properly
Initialize ModeIdIndex according to the selected video mode. Currently index 0 is always used and wrong video mode data may be used. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/xgifb')
-rw-r--r--drivers/staging/xgifb/XGI_main_26.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index c703b83a4eab..67323b1d1b3c 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -190,7 +190,7 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr,
u32 *vmode)
{
unsigned short ModeNo = modeno;
- unsigned short ModeIdIndex = 0, index = 0;
+ unsigned short ModeIdIndex, index = 0;
unsigned short RefreshRateTableIndex = 0;
unsigned short VRE, VBE, VRS, VBS, VDE, VT;
@@ -199,6 +199,8 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr,
unsigned long cr_data3;
int A, B, C, D, E, F, temp, j;
InitTo330Pointer(HwDeviceExtension->jChipType, XGI_Pr);
+ if (!XGI_SearchModeID(ModeNo, &ModeIdIndex, XGI_Pr))
+ return 0;
RefreshRateTableIndex = XGI_GetRatePtrCRT2(HwDeviceExtension, ModeNo,
ModeIdIndex, XGI_Pr);
index = XGI_Pr->RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;