Browse Source

Vl53lxx Driver Coverity Fixes (#9671)

sbg
DanielePettenuzzo 7 years ago committed by Daniel Agar
parent
commit
1da87aa173
  1. 11
      src/drivers/distance_sensor/vl53lxx/vl53lxx.cpp

11
src/drivers/distance_sensor/vl53lxx/vl53lxx.cpp

@ -213,7 +213,8 @@ VL53LXX::VL53LXX(uint8_t rotation, int bus, int address) : @@ -213,7 +213,8 @@ VL53LXX::VL53LXX(uint8_t rotation, int bus, int address) :
_orb_class_instance(-1),
_distance_sensor_topic(nullptr),
_sample_perf(perf_alloc(PC_ELAPSED, "vl53lxx_read")),
_comms_errors(perf_alloc(PC_COUNT, "vl53lxx_com_err"))
_comms_errors(perf_alloc(PC_COUNT, "vl53lxx_com_err")),
_stop_variable(0)
{
// up the retries since the device misses the first measure attempts
I2C::_retries = 3;
@ -989,7 +990,7 @@ void info(); @@ -989,7 +990,7 @@ void info();
void
start(uint8_t rotation)
{
int fd;
int fd = -1;
if (g_dev != nullptr) {
errx(1, "already started");
@ -1022,6 +1023,10 @@ start(uint8_t rotation) @@ -1022,6 +1023,10 @@ start(uint8_t rotation)
fail:
if (fd >= 0) {
close(fd);
}
if (g_dev != nullptr) {
delete g_dev;
g_dev = nullptr;
@ -1073,6 +1078,8 @@ test() @@ -1073,6 +1078,8 @@ test()
print_message(report);
close(fd);
errx(0, "PASS");
}

Loading…
Cancel
Save