frudevice: fix useless-cast
error: useless cast to type 'int' [-Werror=useless-cast]
Tested: CI builds.
Tested: Build builds.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I86786c7c25ef2952cd4b89324c663d737b94a7eb
diff --git a/src/FruDevice.cpp b/src/FruDevice.cpp
index 4d5486d..492e7ff 100644
--- a/src/FruDevice.cpp
+++ b/src/FruDevice.cpp
@@ -103,8 +103,8 @@
}
}
-static int readFromEeprom(int flag __attribute__((unused)), int fd,
- uint16_t offset, uint8_t len, uint8_t* buf)
+static int64_t readFromEeprom(int flag __attribute__((unused)), int fd,
+ uint16_t offset, uint8_t len, uint8_t* buf)
{
auto result = lseek(fd, offset, SEEK_SET);
if (result < 0)
@@ -113,7 +113,7 @@
return -1;
}
- return static_cast<int>(read(fd, buf, len));
+ return read(fd, buf, len);
}
static bool isMuxBus(size_t bus)
@@ -169,8 +169,8 @@
return 0;
}
-static int readBlockData(int flag, int file, uint16_t offset, uint8_t len,
- uint8_t* buf)
+static int64_t readBlockData(int flag, int file, uint16_t offset, uint8_t len,
+ uint8_t* buf)
{
uint8_t lowAddr = static_cast<uint8_t>(offset);
uint8_t highAddr = static_cast<uint8_t>(offset >> 8);
@@ -252,7 +252,7 @@
return device;
}
- int readBytes = readFromEeprom(0, file, 0, 0x8, blockData.data());
+ auto readBytes = readFromEeprom(0, file, 0, 0x8, blockData.data());
if (readBytes < 0)
{
std::cerr << "failed to read eeprom at " << bus << " address "