hal-api: common: Do not treat "No such file or directory" as error log 42/276342/6 accepted/tizen/unified/20220622.134045 submit/tizen/20220620.072007
authorYoungjae Cho <y0.cho@samsung.com>
Wed, 15 Jun 2022 04:25:37 +0000 (13:25 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Thu, 16 Jun 2022 03:38:45 +0000 (12:38 +0900)
There might be an environment that naturally has no hal backend. For
the environment, changed log level to info so that not to be confused
as an error.

Change-Id: Ia458d7ec6c5bc89cbe58a35df0f7d6343bceae66
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/hal-api-common.c

index 8273b72..d11226b 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <stdio.h>
 #include <stdint.h>
+#include <unistd.h>
 #include <stdbool.h>
 #include <dlfcn.h>
 #include <dirent.h>
@@ -146,6 +147,11 @@ static int __open_backend(struct __hal_module_info *info)
                                info->module_name);
                ret = -EINVAL;
                goto err;
+       } else if (access(backend_library_name, F_OK) == -1) {
+               _I("%s: There is no backend library\n",
+                               info->module_name);
+               ret = -ENOENT;
+               goto err;
        }
 
        if (!info->symbol_name) {
@@ -292,12 +298,8 @@ static int __get_backend(enum hal_module module, void **data,
        }
 
        ret = __open_backend(info);
-       if (ret < 0) {
-               _E("%s: Failed to get the backend library by dlopen\n",
-                               info->module_name);
-               ret = -EINVAL;
+       if (ret < 0)
                goto err;
-       }
 
        ret = __init_backend(info, data, NULL);
        if (ret < 0) {
@@ -414,12 +416,8 @@ static int __get_backend_data(enum hal_module module, unsigned int *abi_version,
        }
 
        ret = __open_backend(info);
-       if (ret < 0) {
-               _E("%s: Failed to get the backend library by dlopen\n",
-                               info->module_name);
-               ret = -EINVAL;
+       if (ret < 0)
                goto err_conf_exit;
-       }
 
        /* Return abi_verion of hal_backend structure */
        if (!name_size && !vendor_size) {