From 0e2461ffd2780b0e5128790a2cb1c2da2371a97c Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Sat, 20 Jan 2024 10:03:15 +1100 Subject: [PATCH] AP_AccelCal: remove pointless assignment when counting calibrators cal isn't used after the assignment is made. Pointed out by clang-scan-build --- libraries/AP_AccelCal/AP_AccelCal.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_AccelCal/AP_AccelCal.cpp b/libraries/AP_AccelCal/AP_AccelCal.cpp index 8cf1fc126a..d4fa4cba03 100644 --- a/libraries/AP_AccelCal/AP_AccelCal.cpp +++ b/libraries/AP_AccelCal/AP_AccelCal.cpp @@ -44,9 +44,8 @@ void AP_AccelCal::update() if (_started) { update_status(); - AccelCalibrator *cal; uint8_t num_active_calibrators = 0; - for(uint8_t i=0; (cal = get_calibrator(i)); i++) { + for(uint8_t i=0; get_calibrator(i) != nullptr; i++) { num_active_calibrators++; } if (num_active_calibrators != _num_active_calibrators) { @@ -56,6 +55,7 @@ void AP_AccelCal::update() if(_start_collect_sample) { collect_sample(); } + AccelCalibrator *cal; switch(_status) { case ACCEL_CAL_NOT_STARTED: fail();