summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJihoon Jung <jh8801.jung@samsung.com>2024-07-11 16:54:58 +0900
committerJihoon Jung <jh8801.jung@samsung.com>2024-07-11 17:05:33 +0900
commit887e9d6d189213e7b685cf39c9c4471f1ff856a8 (patch)
treeae55062aefefa02b595b0b84492734412ee6c8c9
parentef265c7086810b6a82714f33d5a8316a44de33d7 (diff)
downloadzigbee-accepted/tizen_unified.tar.gz
zigbee-accepted/tizen_unified.tar.bz2
zigbee-accepted/tizen_unified.zip
Change-Id: Ib338fe6998ca41c820ebe19fda10ba85d11752ca Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
-rw-r--r--[-rwxr-xr-x]src/hal-api-zigbee.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/hal-api-zigbee.c b/src/hal-api-zigbee.c
index 890baa7..ccd09d3 100755..100644
--- a/src/hal-api-zigbee.c
+++ b/src/hal-api-zigbee.c
@@ -43,10 +43,15 @@ int hal_zigbee_get_backend(void)
if (g_zigbee_funcs)
return 0;
+ g_zigbee_funcs = calloc(1, sizeof(hal_backend_zigbee_funcs));
+ if (!g_zigbee_funcs)
+ return -ENOMEM;
+
ret = hal_common_get_backend(HAL_MODULE_ZIGBEE, (void **)&g_zigbee_funcs);
if (ret < 0) {
- _E("Failed to get backend\n");
- return -EINVAL;
+ free(g_zigbee_funcs);
+ g_zigbee_funcs = NULL;
+ return -ENOTSUP;
}
return 0;
@@ -55,16 +60,12 @@ int hal_zigbee_get_backend(void)
EXPORT
int hal_zigbee_put_backend(void)
{
- int ret;
-
if (!g_zigbee_funcs)
return -EINVAL;
- ret = hal_common_put_backend(HAL_MODULE_ZIGBEE, (void *)g_zigbee_funcs);
- if (ret < 0) {
- _E("Failed to put backend\n");
- return -EINVAL;
- }
+ hal_common_put_backend(HAL_MODULE_ZIGBEE, (void *)g_zigbee_funcs);
+
+ free(g_zigbee_funcs);
g_zigbee_funcs = NULL;
return 0;