undefined4 rtmp_nv_init(undefined4 param_1)
{
ushort uVar1;
void *pvVar2;
uint uVar3;
int iVar4;
char *pcVar5;
uint uVar6;
ushort *puVar7;
ushort *puVar8;
ushort local_20 [4];
if (2 < RTDebugLevel) {
printk("--> rtmp_nv_init\n");
}
if (EeBuffer == (void *)0x0) {
if (RTDebugLevel == 0) {
return 1;
}
pcVar5 = "EeBuffer == NULL!!!\n";
}
else {
if ((init_flag != '\0') && (g_EeBuffer_cache != (void *)0x0)) {
memcpy(EeBuffer,g_EeBuffer_cache,0x200) //possible issue identified - semgrep
return 0;
}
RtmpFlashRead(EeBuffer,0x34000,0x200) //possible issue identified - semgrep
pvVar2 = EeBuffer;
init_flag = '\x01';
nv_ee_start = EeBuffer;
rtmp_ee_flash_read(param_1,0,local_20) //possible issue identified - semgrep
puVar8 = &EE_FLASH_ID_LIST;
puVar7 = puVar8;
while (puVar7 != (ushort *)0xcb6fa) {
uVar1 = *puVar7;
puVar7 = puVar7 + 1;
if (local_20[0] == uVar1) {
return 0;
}
}
iVar4 = rtmp_ee_flash_reset(pvVar2);
if (iVar4 == 0) {
rtmp_ee_flash_read(param_1,8,local_20) //possible issue identified - semgrep
uVar6 = (uint)(byte)local_20[0];
local_20[0] = local_20[0] & 0xff;
uVar3 = RandomByte(param_1);
uVar6 = (uVar3 & 0xf8) << 8 | uVar6;
local_20[0] = (ushort)uVar6;
rtmp_ee_flash_write(param_1,8,uVar6);
if (RTDebugLevel != 0) {
printk("The EEPROM in Flash is wrong, use default\n");
}
rtmp_ee_flash_read(param_1,0,local_20) //possible issue identified - semgrep
while (puVar8 != (ushort *)0xcb6fa) {
uVar1 = *puVar8;
puVar8 = puVar8 + 1;
if (local_20[0] == uVar1) {
return 0;
}
}
if (RTDebugLevel == 0) {
return 1;
}
pcVar5 = "rtmp_ee_flash_init(): invalid eeprom\n";
}
else {
if (RTDebugLevel == 0) {
return 1;
}
pcVar5 = "rtmp_ee_init(): rtmp_ee_flash_init() failed\n";
}
}
printk(pcVar5);
return 1;
}