Skip to content

Commit 24108ed

Browse files
haoxian2zibaiwan
authored andcommitted
Fixed coverity in acl_globals.cpp: Unchecked return value (CHECKED_RETURN)
The function acl_init_from_hal_discovery that contains the acl_set_hal issue is initializing the HAL and load the builtin system definition. acl_set_hal returns 0 if HAL is unvalid. Therefore, I believe that if the HAL is not valid, it should be considered as uninitialized since we cannot fetch the correct builtin system definition.
1 parent 96630bc commit 24108ed

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/acl_globals.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ cl_bool acl_init_from_hal_discovery(void) {
203203
return CL_FALSE;
204204
}
205205
// Probe the HAL for a device.
206-
acl_set_hal(board_hal);
206+
if (!acl_set_hal(board_hal)) {
207+
return CL_FALSE;
208+
}
207209

208210
if (use_offline_only != ACL_CONTEXT_OFFLINE_ONLY) {
209211
acl_present_board_is_valid_value = 1;

0 commit comments

Comments
 (0)