summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJihoon Jung <jh8801.jung@samsung.com>2024-07-11 16:35:46 +0900
committerJihoon Jung <jh8801.jung@samsung.com>2024-07-11 16:37:15 +0900
commitfc3e4b4993398c8aaa21c77182d70f97e4c8454d (patch)
tree0894c65d94fa626eda9d2e7e87ebe34e526adb95
parent1e519193b65205ff66fcd340a7ad3b66997d4ec6 (diff)
downloadnfc-tizen_9.0.tar.gz
nfc-tizen_9.0.tar.bz2
nfc-tizen_9.0.zip
Change-Id: Ia76e357e4bdf5f98ad32b6e8bf919a34178285cf Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
-rw-r--r--[-rwxr-xr-x]src/hal-api-nfc.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/hal-api-nfc.c b/src/hal-api-nfc.c
index ad25aef..30147cc 100755..100644
--- a/src/hal-api-nfc.c
+++ b/src/hal-api-nfc.c
@@ -43,10 +43,15 @@ int hal_nfc_get_backend(void)
if (g_nfc_funcs)
return 0;
+ g_nfc_funcs = calloc(1, sizeof(hal_backend_nfc_funcs));
+ if (!g_nfc_funcs)
+ return -ENOMEM;
+
ret = hal_common_get_backend(HAL_MODULE_NFC, (void **)&g_nfc_funcs);
if (ret < 0) {
- _E("Failed to get backend\n");
- return -EINVAL;
+ free(g_nfc_funcs);
+ g_nfc_funcs = NULL;
+ return -ENOTSUP;
}
return 0;
@@ -55,16 +60,12 @@ int hal_nfc_get_backend(void)
EXPORT
int hal_nfc_put_backend(void)
{
- int ret;
-
if (!g_nfc_funcs)
return -EINVAL;
- ret = hal_common_put_backend(HAL_MODULE_NFC, (void *)g_nfc_funcs);
- if (ret < 0) {
- _E("Failed to put backend\n");
- return -EINVAL;
- }
+ hal_common_put_backend(HAL_MODULE_NFC, (void *)g_nfc_funcs);
+
+ free(g_nfc_funcs);
g_nfc_funcs = NULL;
return 0;