staging/xgifb: Simplify XGI_GetRatePtrCRT2
Since the smaller LCDRefreshIndex is contained identically in LCDARefreshIndex we can simply use LCDARefreshIndex and skip the if/else. Since LCDARefreshIndex is only used readonly and contains only small unsigned values we also change its declaration to const u8. In order to prevent an out-of-bounds access I changed the mask from 0x0F to 0x07 and added a dummy value. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3de738cd30
commit
f2c22605c5
1 changed files with 4 additions and 12 deletions
|
@ -5470,9 +5470,8 @@ unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
|
||||||
unsigned short ModeNo, unsigned short ModeIdIndex,
|
unsigned short ModeNo, unsigned short ModeIdIndex,
|
||||||
struct vb_device_info *pVBInfo)
|
struct vb_device_info *pVBInfo)
|
||||||
{
|
{
|
||||||
short LCDRefreshIndex[] = { 0x00, 0x00, 0x03, 0x01 },
|
const u8 LCDARefreshIndex[] = {
|
||||||
LCDARefreshIndex[] = { 0x00, 0x00, 0x03, 0x01, 0x01,
|
0x00, 0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x00 };
|
||||||
0x01, 0x01 };
|
|
||||||
|
|
||||||
unsigned short RefreshRateTableIndex, i, index, temp;
|
unsigned short RefreshRateTableIndex, i, index, temp;
|
||||||
|
|
||||||
|
@ -5489,15 +5488,8 @@ unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
|
||||||
if (pVBInfo->SetFlag & ProgrammingCRT2) {
|
if (pVBInfo->SetFlag & ProgrammingCRT2) {
|
||||||
if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) {
|
if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) {
|
||||||
if (pVBInfo->IF_DEF_LVDS == 0) {
|
if (pVBInfo->IF_DEF_LVDS == 0) {
|
||||||
if (pVBInfo->VBType & (VB_SIS301B | VB_SIS302B
|
temp = LCDARefreshIndex[
|
||||||
| VB_SIS301LV | VB_SIS302LV
|
pVBInfo->LCDResInfo & 0x07];
|
||||||
| VB_XGI301C))
|
|
||||||
/* 301b */
|
|
||||||
temp = LCDARefreshIndex[
|
|
||||||
pVBInfo->LCDResInfo & 0x0F];
|
|
||||||
else
|
|
||||||
temp = LCDRefreshIndex[
|
|
||||||
pVBInfo->LCDResInfo & 0x0F];
|
|
||||||
|
|
||||||
if (index > temp)
|
if (index > temp)
|
||||||
index = temp;
|
index = temp;
|
||||||
|
|
Loading…
Add table
Reference in a new issue