sensors: Fix error at init if VPD table is not present.
Initialize the variable array before filling it.
Found the problem on cyan-cheets, dragon uses similar sensor_hal.
BUG=chrome-os-partner:45679
TEST=On cyan, if VPD is missing, check error message is gone.
Change-Id: Ide273ad1be0f4016eb2ff53e250990b470d75600
Signed-off-by: Gwendal Grignou <gwendal@google.com>
diff --git a/sensor_hub/sensors.cpp b/sensor_hub/sensors.cpp
index 0b7cd20..3ec531d 100644
--- a/sensor_hub/sensors.cpp
+++ b/sensor_hub/sensors.cpp
@@ -355,6 +355,8 @@
for (int i = X ; i < MAX_AXIS; i++) {
snprintf(calib_key[i], sizeof(calib_key[i]), "%s_%c_calibbias",
cros_ec_iio_axis_names[sensor_type], 'x' + i);
+ }
+ for (int i = X ; i < MAX_AXIS; i++) {
if (cros_ec_sysfs_get_attr(vpd_path, calib_key[i], calib_value[i])) {
ALOGI("Calibration key %s missing.\n", calib_key[i]);
calib_data_valid = false;