staging: keucr: Use memcmp() instead custom StringCmp() and some style cleanups
staging: keucr: Use memcmp() instead custom StringCmp() and some style cleanups Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com> Acked-by: Dan Carpenter <error27@gmail.com> Reviewed-by: Marcin Slusarz <marcin.slusarz@gmail.com> Cc: Al Cho <acho@novell.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
2591418bb1
commit
1b5b4e17e5
|
@ -1482,54 +1482,40 @@ BYTE _Check_D_DevCode(BYTE dcode)
|
||||||
//----- Check_D_ReadError() ----------------------------------------------
|
//----- Check_D_ReadError() ----------------------------------------------
|
||||||
int Check_D_ReadError(BYTE *redundant)
|
int Check_D_ReadError(BYTE *redundant)
|
||||||
{
|
{
|
||||||
// Driver 不做 ECC Check
|
return SUCCESS;
|
||||||
return(SUCCESS);
|
|
||||||
if (!StringCmp((char *)(redundant+0x0D),(char *)EccBuf,3))
|
|
||||||
if (!StringCmp((char *)(redundant+0x08),(char *)(EccBuf+0x03),3))
|
|
||||||
return(SUCCESS);
|
|
||||||
|
|
||||||
return(ERROR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----- Check_D_Correct() ----------------------------------------------
|
//----- Check_D_Correct() ----------------------------------------------
|
||||||
int Check_D_Correct(BYTE *buf,BYTE *redundant)
|
int Check_D_Correct(BYTE *buf,BYTE *redundant)
|
||||||
{
|
{
|
||||||
// Driver 不做 ECC Check
|
return SUCCESS;
|
||||||
return(SUCCESS);
|
|
||||||
if (StringCmp((char *)(redundant+0x0D),(char *)EccBuf,3))
|
|
||||||
if (_Correct_D_SwECC(buf,redundant+0x0D,EccBuf))
|
|
||||||
return(ERROR);
|
|
||||||
|
|
||||||
buf+=0x100;
|
|
||||||
if (StringCmp((char *)(redundant+0x08),(char *)(EccBuf+0x03),3))
|
|
||||||
if (_Correct_D_SwECC(buf,redundant+0x08,EccBuf+0x03))
|
|
||||||
return(ERROR);
|
|
||||||
|
|
||||||
return(SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----- Check_D_CISdata() ----------------------------------------------
|
//----- Check_D_CISdata() ----------------------------------------------
|
||||||
int Check_D_CISdata(BYTE *buf, BYTE *redundant)
|
int Check_D_CISdata(BYTE *buf, BYTE *redundant)
|
||||||
{
|
{
|
||||||
BYTE cis[]={0x01,0x03,0xD9,0x01,0xFF,0x18,0x02,0xDF,0x01,0x20};
|
BYTE cis[] = {0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02,
|
||||||
|
0xDF, 0x01, 0x20};
|
||||||
|
|
||||||
if (!IsSSFDCCompliance && !IsXDCompliance)
|
int cis_len = sizeof(cis);
|
||||||
return(SUCCESS); // 目前為強制 SUCCESS [Arnold 02-08-23] SSFDC 測試, 不能強制 SUCCESS
|
|
||||||
|
|
||||||
if (!StringCmp((char *)(redundant+0x0D),(char *)EccBuf,3))
|
if (!IsSSFDCCompliance && !IsXDCompliance)
|
||||||
return(StringCmp((char *)buf,(char *)cis,10));
|
return SUCCESS;
|
||||||
|
|
||||||
if (!_Correct_D_SwECC(buf,redundant+0x0D,EccBuf))
|
if (!memcmp(redundant + 0x0D, EccBuf, 3))
|
||||||
return(StringCmp((char *)buf,(char *)cis,10));
|
return memcmp(buf, cis, cis_len);
|
||||||
|
|
||||||
buf+=0x100;
|
if (!_Correct_D_SwECC(buf, redundant + 0x0D, EccBuf))
|
||||||
if (!StringCmp((char *)(redundant+0x08),(char *)(EccBuf+0x03),3))
|
return memcmp(buf, cis, cis_len);
|
||||||
return(StringCmp((char *)buf,(char *)cis,10));
|
|
||||||
|
|
||||||
if (!_Correct_D_SwECC(buf,redundant+0x08,EccBuf+0x03))
|
buf += 0x100;
|
||||||
return(StringCmp((char *)buf,(char *)cis,10));
|
if (!memcmp(redundant + 0x08, EccBuf + 0x03, 3))
|
||||||
|
return memcmp(buf, cis, cis_len);
|
||||||
|
|
||||||
return(ERROR);
|
if (!_Correct_D_SwECC(buf, redundant + 0x08, EccBuf + 0x03))
|
||||||
|
return memcmp(buf, cis, cis_len);
|
||||||
|
|
||||||
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----- Set_D_RightECC() ----------------------------------------------
|
//----- Set_D_RightECC() ----------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue