@@ -113,6 +113,9 @@ static ze_result_t enumerate_zes_devices(void)
113
113
}
114
114
115
115
zes_handles = calloc (count , sizeof (zes_device_handle_t ));
116
+ if (zes_handles == NULL ) {
117
+ return ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY ;
118
+ }
116
119
117
120
res = zesDeviceGet (handle , & count , zes_handles );
118
121
if (res != ZE_RESULT_SUCCESS ) {
@@ -355,7 +358,7 @@ bool zes_device_bus_is_healthy(char* bdf_address, uint32_t* error)
355
358
double zes_device_temp_max (char * bdf_address , char * sensor , uint32_t * error )
356
359
{
357
360
if (getenv ("UNITTEST" ) != NULL ) {
358
- return -999.0 ;
361
+ return TEMP_ERROR_RET_VAL ;
359
362
}
360
363
361
364
uint32_t requestedType = 0 ;
@@ -368,7 +371,7 @@ double zes_device_temp_max(char* bdf_address, char* sensor, uint32_t* error)
368
371
} else {
369
372
* error = ZE_RESULT_ERROR_INVALID_ARGUMENT ;
370
373
371
- return -999.0 ;
374
+ return TEMP_ERROR_RET_VAL ;
372
375
}
373
376
374
377
print_log (LOG_DEBUG , "Fetch %s temperature for %s\n" , sensor , bdf_address );
@@ -378,31 +381,31 @@ double zes_device_temp_max(char* bdf_address, char* sensor, uint32_t* error)
378
381
if (res != ZE_RESULT_SUCCESS ) {
379
382
* error = res ;
380
383
381
- return -999.0 ;
384
+ return TEMP_ERROR_RET_VAL ;
382
385
}
383
386
}
384
387
385
388
zes_device_handle_t handle = retrieve_handle_for_bdf (bdf_address );
386
389
if (handle == 0 ) {
387
390
* error = ZE_RESULT_ERROR_UNKNOWN ;
388
391
389
- return -999.0 ;
392
+ return TEMP_ERROR_RET_VAL ;
390
393
}
391
394
392
395
uint32_t count = 0 ;
393
396
ze_result_t res = zesDeviceEnumTemperatureSensors (handle , & count , NULL );
394
397
if (res != ZE_RESULT_SUCCESS || count == 0 ) {
395
398
* error = res ;
396
399
397
- return -999.0 ;
400
+ return TEMP_ERROR_RET_VAL ;
398
401
}
399
402
400
403
zes_temp_handle_t tempHandles [count ];
401
404
res = zesDeviceEnumTemperatureSensors (handle , & count , tempHandles );
402
405
if (res != ZE_RESULT_SUCCESS ) {
403
406
* error = res ;
404
407
405
- return -999.0 ;
408
+ return TEMP_ERROR_RET_VAL ;
406
409
}
407
410
408
411
for (uint32_t i = 0 ; i < count ; ++ i ) {
@@ -412,7 +415,7 @@ double zes_device_temp_max(char* bdf_address, char* sensor, uint32_t* error)
412
415
if (res != ZE_RESULT_SUCCESS ) {
413
416
* error = res ;
414
417
415
- return -999.0 ;
418
+ return TEMP_ERROR_RET_VAL ;
416
419
}
417
420
418
421
if (props .type != requestedType ) {
@@ -424,7 +427,7 @@ double zes_device_temp_max(char* bdf_address, char* sensor, uint32_t* error)
424
427
if (res != ZE_RESULT_SUCCESS ) {
425
428
* error = res ;
426
429
427
- return -999.0 ;
430
+ return TEMP_ERROR_RET_VAL ;
428
431
}
429
432
430
433
print_log (LOG_DEBUG , "> Temperature: %.1f\n" , tempCelsius );
@@ -434,5 +437,5 @@ double zes_device_temp_max(char* bdf_address, char* sensor, uint32_t* error)
434
437
435
438
* error = ZE_RESULT_ERROR_NOT_AVAILABLE ;
436
439
437
- return -999.0 ;
440
+ return TEMP_ERROR_RET_VAL ;
438
441
}
0 commit comments