diff --git a/unified-runtime/source/adapters/level_zero/common/device.cpp b/unified-runtime/source/adapters/level_zero/common/device.cpp index e9cc3e31b4bb..b48109629495 100644 --- a/unified-runtime/source/adapters/level_zero/common/device.cpp +++ b/unified-runtime/source/adapters/level_zero/common/device.cpp @@ -1471,12 +1471,18 @@ ur_result_t urDeviceGetInfo( int32_t Speed = -1; for (auto Fan : ZeFanHandles) { int32_t CurSpeed; - auto result = ze2urResult(ZE_CALL_NOCHECK( - zesFanGetState, (Fan, ZES_FAN_SPEED_UNITS_PERCENT, &CurSpeed))); - if (result != UR_RESULT_SUCCESS) - return result == UR_RESULT_ERROR_UNSUPPORTED_FEATURE + // Some drivers/KMDs report an enumerated fan as unreadable via + // ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, others via + // ZE_RESULT_ERROR_NOT_AVAILABLE. Treat both as "unsupported" so the + // query is reported consistently instead of surfacing an unrelated + // UR error (e.g. UR_RESULT_ERROR_INVALID_OPERATION). + ze_result_t ZeResult = ZE_CALL_NOCHECK( + zesFanGetState, (Fan, ZES_FAN_SPEED_UNITS_PERCENT, &CurSpeed)); + if (ZeResult != ZE_RESULT_SUCCESS) + return (ZeResult == ZE_RESULT_ERROR_UNSUPPORTED_FEATURE || + ZeResult == ZE_RESULT_ERROR_NOT_AVAILABLE) ? UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION - : result; + : ze2urResult(ZeResult); Speed = std::max(Speed, CurSpeed); } return ReturnValue(Speed);