fix(libtl): typecast expression to match data type
This corrects the MISRA violation C2012-10.1:
Operands shall not be of an inappropriate essential type.
The original code used an expression of a non-Boolean essential type
in a Boolean context. To comply with the rule, the expression has been
replaced with an explicit comparison to a Boolean-compatible
value (e.g., == NULL, != 0U, ensuring clarity and type safety.
Change-Id: Iac29e26415267e6287b523e1535fcda1d4fcf0de
Signed-off-by: Pranav Tilak <pranav.vinaytilak@amd.com>
diff --git a/include/logging.h b/include/logging.h
index fdfb2cd..6cd1ab6 100644
--- a/include/logging.h
+++ b/include/logging.h
@@ -15,16 +15,16 @@
extern struct logger_interface *logger;
-#define info(...) \
- do { \
- if (logger && logger->info) \
- logger->info(__VA_ARGS__); \
+#define info(...) \
+ do { \
+ if ((logger != NULL) && (logger->info != NULL)) \
+ logger->info(__VA_ARGS__); \
} while (0)
-#define warn(...) \
- do { \
- if (logger && logger->warn) \
- logger->warn(__VA_ARGS__); \
+#define warn(...) \
+ do { \
+ if ((logger != NULL) && (logger->warn != NULL)) \
+ logger->warn(__VA_ARGS__); \
} while (0)
#define error(...) \