Fix the bugs found in static analysis
This commit fixes the following static analyzer reported issues:
Operands don't affect result
some conditions are not required to check as its always true
Unsigned compared against 0
Unchecked return value from library
Uninitialized scalar variable
Change-Id: I0b1fd426794bb88f6eafcc817cef5dd2f655e1ba
Signed-off-by: PavanKumarIntel <pavanx.kumar.martha@intel.com>
diff --git a/user_channel/channel_layer.cpp b/user_channel/channel_layer.cpp
index fb70f1e..85c3426 100644
--- a/user_channel/channel_layer.cpp
+++ b/user_channel/channel_layer.cpp
@@ -51,9 +51,7 @@
bool isValidAccessMode(const uint8_t accessMode)
{
- return (
- (accessMode >= static_cast<uint8_t>(EChannelAccessMode::disabled)) &&
- (accessMode <= static_cast<uint8_t>(EChannelAccessMode::shared)));
+ return (accessMode <= static_cast<uint8_t>(EChannelAccessMode::shared));
}
bool isValidChannel(const uint8_t chNum)