Initialize variables and validate pointers before actually using them

Change-Id: Iae6fbeac124e1a02da419f5071e1ebc292b390cf
Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
This commit is contained in:
Jitendra Sharma
2020-07-13 21:50:32 +05:30
committed by sys_ocldev
parent 63721561f3
commit 92b15507b0
11 changed files with 17 additions and 10 deletions

View File

@@ -39,7 +39,7 @@ struct EngineHandleContext {
ze_result_t engineGet(uint32_t *pCount, zet_sysman_engine_handle_t *phEngine);
OsSysman *pOsSysman = nullptr;
std::vector<Engine *> handleList;
std::vector<Engine *> handleList = {};
};
} // namespace L0

View File

@@ -41,7 +41,7 @@ struct FabricPortHandleContext {
ze_result_t fabricPortGet(uint32_t *pCount, zet_sysman_fabric_port_handle_t *phPort);
OsSysman *pOsSysman = nullptr;
std::vector<FabricPort *> handleList;
std::vector<FabricPort *> handleList = {};
};
} // namespace L0

View File

@@ -40,7 +40,7 @@ struct FrequencyHandleContext {
ze_result_t frequencyGet(uint32_t *pCount, zet_sysman_freq_handle_t *phFrequency);
OsSysman *pOsSysman;
std::vector<Frequency *> handle_list;
std::vector<Frequency *> handle_list = {};
};
} // namespace L0

View File

@@ -40,7 +40,7 @@ struct MemoryHandleContext {
OsSysman *pOsSysman = nullptr;
bool isLmemSupported = false;
std::vector<Memory *> handleList;
std::vector<Memory *> handleList = {};
ze_device_handle_t hCoreDevice;
};

View File

@@ -31,7 +31,7 @@ class PciImp : public Pci, NEO::NonCopyableOrMovableClass {
private:
OsSysman *pOsSysman = nullptr;
zet_pci_properties_t pciProperties = {};
std::vector<zet_pci_bar_properties_t *> pciBarProperties;
std::vector<zet_pci_bar_properties_t *> pciBarProperties = {};
};
} // namespace L0

View File

@@ -41,7 +41,7 @@ struct PowerHandleContext {
ze_result_t powerGet(uint32_t *pCount, zet_sysman_pwr_handle_t *phPower);
OsSysman *pOsSysman = nullptr;
std::vector<Power *> handleList;
std::vector<Power *> handleList = {};
};
} // namespace L0

View File

@@ -42,7 +42,7 @@ struct RasHandleContext {
ze_result_t rasGet(uint32_t *pCount, zet_sysman_ras_handle_t *phRas);
OsSysman *pOsSysman = nullptr;
std::vector<Ras *> handleList;
std::vector<Ras *> handleList = {};
private:
void createHandle(zet_ras_error_type_t type);

View File

@@ -38,7 +38,7 @@ struct StandbyHandleContext {
ze_result_t standbyGet(uint32_t *pCount, zet_sysman_standby_handle_t *phStandby);
OsSysman *pOsSysman;
std::vector<Standby *> handle_list;
std::vector<Standby *> handle_list = {};
};
} // namespace L0

View File

@@ -54,7 +54,7 @@ ze_result_t SysmanHandleContext::sysmanGet(zet_device_handle_t hDevice, zet_sysm
SysmanDevice *SysmanDeviceHandleContext::init(ze_device_handle_t device) {
auto isSysmanEnabled = getenv("ZES_ENABLE_SYSMAN");
if (isSysmanEnabled == nullptr) {
if ((isSysmanEnabled == nullptr) || (device == nullptr)) {
return nullptr;
}
auto isSysmanEnabledAsInt = atoi(isSysmanEnabled);

View File

@@ -41,7 +41,7 @@ struct TemperatureHandleContext {
ze_result_t temperatureGet(uint32_t *pCount, zet_sysman_temp_handle_t *phTemperature);
OsSysman *pOsSysman = nullptr;
std::vector<Temperature *> handleList;
std::vector<Temperature *> handleList = {};
private:
void createHandle(zet_temp_sensors_t type);