Skip to content
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

[test] Add haltests package #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add null check in api
Add param null checks in hal_ml_create and hal_ml_destroy

Signed-off-by: Yongjoo Ahn <[email protected]>
  • Loading branch information
anyj0527 committed Mar 7, 2025
commit 2d56d4961d10c523d121bb9301263045c8899cd1
16 changes: 16 additions & 0 deletions src/hal-api-ml.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ hal_ml_param_get (hal_ml_param_h param, const char *key, void **value)
int
hal_ml_create (const char *backend_name, hal_ml_h *handle)
{
if (!handle) {
_E ("Got invalid handle");
return HAL_ML_ERROR_INVALID_PARAMETER;
}

if (!backend_name) {
_E ("Got invalid backend name");
return HAL_ML_ERROR_INVALID_PARAMETER;
}

/* Scan backend only once */
static int scanned = 1;
if (scanned == 1) {
Expand Down Expand Up @@ -219,6 +229,12 @@ int
hal_ml_destroy (hal_ml_h handle)
{
hal_ml_s *ml = (hal_ml_s *) handle;

if (!handle) {
_E ("Got invalid handle");
return HAL_ML_ERROR_INVALID_PARAMETER;
}

_I ("Deinitializing backend %s", ml->backend_library_name);

int ret = ml->funcs->deinit (ml->backend_private);
Expand Down