halcc: Return -ENOENT on backend loading failure when getting transport 51/321651/1
authorYoungjae Cho <y0.cho@samsung.com>
Wed, 26 Mar 2025 03:35:48 +0000 (12:35 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Wed, 26 Mar 2025 06:30:31 +0000 (15:30 +0900)
It has changed that the hal_common_get_transport() now distinguishes
those two case below using return value.
 1. Failure due to version mismatch or not supported transport
    -> Return value: -ELIBBAD

 2. Failure due to error related to loading backend library
    -> Return value: -ENOENT

The first one is the case that it succeeded to load backend library,
but version of the library wasn't matched to the platform manifest.
On the other hand, the second case fails to load backend library itself,
for example, there is no installed backend library for a module.

Change-Id: I4b96da46625abe72365ab2c58533780bdfac8452
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
include/hal-common.h
src/hal-api-compatibility-checker.c

index 7b3bf883ec865e36effcf02e34e321627a657c72..0a37294b46bc2dab508e39d55542984809cc4c39 100644 (file)
@@ -345,6 +345,8 @@ int hal_common_get_supported_interface_versions(enum hal_module module,
  * @param[in] module HAL id among enum hal_module
  * @param[out] transport The transport of version that matching to the hal backend installed
  * @return @c 0 on success, otherwise a negative error value
+ * @retval -ELIBBAD Incompatible backend version with platform manifest
+ * @retval -ENOENT No backend library installed or no valid data symbol found
  * @code
  *  // If a module manifest has specified transport like below, and the underlying
  *  // backend is version of 2.0, then it returns HAL_COMMON_TRANSPORT_PASSTHROUGH.
index 837b96f841ea15e5aad6aa82b2b1d966d6048c3d..4ca8e749f2136cf40b71426cadf794c2815a9711 100644 (file)
@@ -545,7 +545,9 @@ int hal_api_cc_get_transport(enum hal_module module, enum hal_common_transport *
                        return ret;
        }
 
-       if (info.compatibility != HAL_COMMON_BACKEND_COMPATIBILITY_COMPATIBLE)
+       if (info.compatibility == HAL_COMMON_BACKEND_COMPATIBILITY_UNKNOWN)
+               return -ENOENT;
+       else if (info.compatibility == HAL_COMMON_BACKEND_COMPATIBILITY_INCOMPATIBLE)
                return -ELIBBAD;
 
        *transport = info.compatible_transport;