From 9746f25a833ac7ac450263458e8896702f489df0 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Fri, 21 Apr 2023 11:04:15 +0900 Subject: [PATCH] tools: lshal: Fix wrong operation when checking flag is set or not When using bit operation for flag, should use 'and' operation. But, lshal.c used the wrong operation. It fix the operatin from 'or' to 'and'. Change-Id: I3a2badb8c61f73a6fc8d98b737fa6d7d4134c9eb Signed-off-by: Chanwoo Choi --- tools/lshal/lshal.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/lshal/lshal.c b/tools/lshal/lshal.c index fa4491b..1a25fc8 100644 --- a/tools/lshal/lshal.c +++ b/tools/lshal/lshal.c @@ -101,7 +101,7 @@ static void lshal_print_hal_backend_info(u_int32_t flags) { lshal_print_border(); for (module = HAL_MODULE_UNKNOWN + 1; module < HAL_MODULE_END; module++) { - if (LSHAL_FLAG_BACKEND_MODULE_NAME | flags) { + if (LSHAL_FLAG_BACKEND_MODULE_NAME & flags) { strncpy(str, "", BUFF_MAX - 1); ret = hal_common_get_backend_module_name(module, str, BUFF_MAX - 1); @@ -111,7 +111,7 @@ static void lshal_print_hal_backend_info(u_int32_t flags) { printf(" %-38s | %-2d |", str, module); } - if (LSHAL_FLAG_BACKEND_LIB_NAME | flags) { + if (LSHAL_FLAG_BACKEND_LIB_NAME & flags) { strncpy(str, "", BUFF_MAX - 1); ret = hal_common_get_backend_library_name(module, str, BUFF_MAX - 1); @@ -121,7 +121,7 @@ static void lshal_print_hal_backend_info(u_int32_t flags) { printf(" %-55s |", str); } - if (LSHAL_FLAG_BACKEND_USAGE_COUNT | flags) { + if (LSHAL_FLAG_BACKEND_USAGE_COUNT & flags) { int count = hal_common_get_backend_count(module); if (count < 0) printf(" %-10s |", ""); @@ -129,7 +129,7 @@ static void lshal_print_hal_backend_info(u_int32_t flags) { printf(" %-10d |", count); } - if (LSHAL_FLAG_BACKEND_VERIFICATION | flags) { + if (LSHAL_FLAG_BACKEND_VERIFICATION & flags) { ret = lshal_verify_hal_backend(module); if (ret == -ENOENT) { @@ -142,7 +142,7 @@ static void lshal_print_hal_backend_info(u_int32_t flags) { } } - if (LSHAL_FLAG_BACKEND_SYMBOL_NAME | flags) { + if (LSHAL_FLAG_BACKEND_SYMBOL_NAME & flags) { strncpy(str, "", BUFF_MAX - 1); ret = hal_common_get_backend_symbol_name(module, str, BUFF_MAX - 1); @@ -152,7 +152,7 @@ static void lshal_print_hal_backend_info(u_int32_t flags) { printf(" %-45s |", str); } - if (LSHAL_FLAG_BACKEND_ABI_VERSION | flags) { + if (LSHAL_FLAG_BACKEND_ABI_VERSION & flags) { strncpy(str, "", BUFF_MAX - 1); ret = hal_common_get_backend_abi_version(module); @@ -162,7 +162,7 @@ static void lshal_print_hal_backend_info(u_int32_t flags) { printf(" %-25s |", hal_abi_version_str[ret]); } - if (LSHAL_FLAG_BACKEND_NAME | flags) { + if (LSHAL_FLAG_BACKEND_NAME & flags) { strncpy(str, "", BUFF_MAX - 1); ret = hal_common_get_backend_name(module, str, BUFF_MAX - 1); @@ -172,7 +172,7 @@ static void lshal_print_hal_backend_info(u_int32_t flags) { printf(" %-25s |", str); } - if (LSHAL_FLAG_BACKEND_VENDOR_NAME | flags) { + if (LSHAL_FLAG_BACKEND_VENDOR_NAME & flags) { strncpy(str, "", BUFF_MAX - 1); ret = hal_common_get_backend_vendor(module, str, BUFF_MAX - 1); -- 2.7.4