Piix4 SMBus: set HANDLE initial value to prevent a crash on rescan

This commit is contained in:
morg
2023-11-14 08:43:06 +01:00
parent 65a3fb9589
commit 999bb03a45
2 changed files with 4 additions and 4 deletions

View File

@@ -26,7 +26,7 @@ i2c_smbus_piix4::i2c_smbus_piix4()
if(amd_smbus_reduce_cpu)
{
delay_timer = CreateWaitableTimerExW(NULL, NULL, CREATE_WAITABLE_TIMER_MANUAL_RESET | CREATE_WAITABLE_TIMER_HIGH_RESOLUTION, TIMER_ALL_ACCESS);
if(!delay_timer) // high resolution timer not supported
if(delay_timer == NULL) // high resolution timer not supported
{
delay_timer = CreateWaitableTimer(NULL, TRUE, NULL); // create regular timer instead
}
@@ -45,7 +45,7 @@ i2c_smbus_piix4::i2c_smbus_piix4()
i2c_smbus_piix4::~i2c_smbus_piix4()
{
if(delay_timer)
if(delay_timer != NULL)
{
CloseHandle(delay_timer);
}
@@ -84,7 +84,7 @@ int i2c_smbus_piix4::piix4_transaction()
/* We will always wait for a fraction of a second! (See PIIX4 docs errata) */
temp = 0;
if(delay_timer)
if(delay_timer != NULL)
{
LARGE_INTEGER retry_delay;
retry_delay.QuadPart = -2500;

View File

@@ -51,6 +51,6 @@ private:
s32 piix4_access(u16 addr, char read_write, u8 command, int size, i2c_smbus_data *data);
s32 i2c_smbus_xfer(u8 addr, char read_write, u8 command, int size, i2c_smbus_data* data);
s32 i2c_xfer(u8 addr, char read_write, int* size, u8* data);
HANDLE delay_timer;
HANDLE delay_timer = NULL;
HANDLE global_smbus_access_handle = NULL;
};