Display error codes should ADL not return ADL_OK in the more critical function calls.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
diff --git a/adl.c b/adl.c
index 278f4d0..0eadeab 100644
--- a/adl.c
+++ b/adl.c
@@ -114,7 +114,7 @@ static bool fanspeed_twin(struct gpu_adl *ga, struct gpu_adl *other_ga)
void init_adl(int nDevs)
{
- int i, j, devices = 0, last_adapter = -1, gpu = 0, dummy = 0;
+ int result, i, j, devices = 0, last_adapter = -1, gpu = 0, dummy = 0;
struct gpu_adapters adapters[MAX_GPUDEVICES], vadapters[MAX_GPUDEVICES];
#if defined (LINUX)
@@ -169,19 +169,22 @@ void init_adl(int nDevs)
// Initialise ADL. The second parameter is 1, which means:
// retrieve adapter information only for adapters that are physically present and enabled in the system
- if (ADL_Main_Control_Create (ADL_Main_Memory_Alloc, 1) != ADL_OK) {
- applog(LOG_INFO, "ADL Initialisation Error!");
+ result = ADL_Main_Control_Create (ADL_Main_Memory_Alloc, 1);
+ if (result != ADL_OK) {
+ applog(LOG_INFO, "ADL Initialisation Error! Error %d!", result);
return ;
}
- if (ADL_Main_Control_Refresh() != ADL_OK) {
- applog(LOG_INFO, "ADL Refresh Error!");
+ result = ADL_Main_Control_Refresh();
+ if (result != ADL_OK) {
+ applog(LOG_INFO, "ADL Refresh Error! Error %d!", result);
return ;
}
// Obtain the number of adapters for the system
- if (ADL_Adapter_NumberOfAdapters_Get ( &iNumberAdapters ) != ADL_OK) {
- applog(LOG_INFO, "Cannot get the number of adapters!\n");
+ result = ADL_Adapter_NumberOfAdapters_Get (&iNumberAdapters);
+ if (result != ADL_OK) {
+ applog(LOG_INFO, "Cannot get the number of adapters! Error %d!", result);
return ;
}
@@ -191,8 +194,9 @@ void init_adl(int nDevs)
lpInfo->iSize = sizeof(lpInfo);
// Get the AdapterInfo structure for all adapters in the system
- if (ADL_Adapter_AdapterInfo_Get (lpInfo, sizeof (AdapterInfo) * iNumberAdapters) != ADL_OK) {
- applog(LOG_INFO, "ADL_Adapter_AdapterInfo_Get Error!");
+ result = ADL_Adapter_AdapterInfo_Get (lpInfo, sizeof (AdapterInfo) * iNumberAdapters);
+ if (result != ADL_OK) {
+ applog(LOG_INFO, "ADL_Adapter_AdapterInfo_Get Error! Error %d", result);
return ;
}
} else {
@@ -207,8 +211,9 @@ void init_adl(int nDevs)
iAdapterIndex = lpInfo[i].iAdapterIndex;
/* Get unique identifier of the adapter, 0 means not AMD */
- if (ADL_Adapter_ID_Get(iAdapterIndex, &lpAdapterID) != ADL_OK) {
- applog(LOG_INFO, "Failed to ADL_Adapter_ID_Get");
+ result = ADL_Adapter_ID_Get(iAdapterIndex, &lpAdapterID);
+ if (result != ADL_OK) {
+ applog(LOG_INFO, "Failed to ADL_Adapter_ID_Get. Error %d", result);
continue;
}
@@ -286,8 +291,9 @@ void init_adl(int nDevs)
gpus[gpu].virtual_gpu = vadapters[gpu].virtual_gpu;
/* Get unique identifier of the adapter, 0 means not AMD */
- if (ADL_Adapter_ID_Get(iAdapterIndex, &lpAdapterID) != ADL_OK) {
- applog(LOG_INFO, "Failed to ADL_Adapter_ID_Get");
+ result = ADL_Adapter_ID_Get(iAdapterIndex, &lpAdapterID);
+ if (result != ADL_OK) {
+ applog(LOG_INFO, "Failed to ADL_Adapter_ID_Get. Error %d", result);
continue;
}