This patch fixes the routine checking device node availability.
The maximum device nodes is uncessarily too large (i.e., 255).
Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
#include "NPUdrvAPI.h"
#include <npubinfmt.h>
-constexpr int max_num_devs = ((1<<CHAR_BIT) - 1);
+/* Only 2 devices are supported for now. 8 will be enough value even in future */
+constexpr int max_num_devs = 8;
constexpr size_t default_buf_size = (256 * PAGE_SIZE);
const std::string TrinityVision2API::dev_node_base = "triv2";
for (int i = 0; i < max_num_devs; ++i) {
path = "/dev/" + TrinityVision2API::dev_node_base + "-" + std::to_string(i);
ret = stat (path.c_str(), &sb);
- if (!ret && S_ISCHR (sb.st_mode)) {
+ if (ret == 0 && S_ISCHR (sb.st_mode)) {
cnt++;
TrinityVision2API::dev_bitset.set(i);
}