-
Notifications
You must be signed in to change notification settings - Fork 35
unify return values for destroy functions #1356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* | ||
* Copyright (C) 2023-2024 Intel Corporation | ||
* Copyright (C) 2023-2025 Intel Corporation | ||
* | ||
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. | ||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
@@ -130,14 +130,15 @@ umf_result_t umfMemspaceNew(umf_memspace_handle_t *hMemspace) { | |
return UMF_RESULT_SUCCESS; | ||
} | ||
|
||
void umfMemspaceDestroy(umf_memspace_handle_t memspace) { | ||
umf_result_t umfMemspaceDestroy(umf_memspace_handle_t memspace) { | ||
assert(memspace); | ||
for (size_t i = 0; i < memspace->size; i++) { | ||
umfMemtargetDestroy(memspace->nodes[i]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check return val from umfMemtargetDestroy and retrun if if != success There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. umfMemtargetDestroy returns void There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. according to this PR umfMemtargetDestroy should at least always return SUCCESS, right? |
||
} | ||
|
||
umf_ba_global_free(memspace->nodes); | ||
umf_ba_global_free(memspace); | ||
return UMF_RESULT_SUCCESS; | ||
} | ||
|
||
umf_result_t umfMemspaceClone(umf_const_memspace_handle_t hMemspace, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just pass the result from finalize()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to return unknown error when error is not recoverable and pool is corrupted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would return the error code received from
ops.finalize()
here - like you have done inumfMemoryProviderDestroy()