summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorSheng-Liang Song <ssl@chromium.org>2014-10-01 18:07:06 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-08 02:51:00 +0000
commitac1c82a35bd0fd41233ec0b0ba13b32f2ea4a331 (patch)
tree8ad238b4f92ea5883a2eca44b7d43d586f7163b2 /common
parent91cfdd0dac2c1a89f3c8fc2aa8af6ce153589026 (diff)
downloadchrome-ec-ac1c82a35bd0fd41233ec0b0ba13b32f2ea4a331.tar.gz
samus: Fixed a bug in host_sensor_id_to_motion_sensor
BUG=chrome-os-partner:32368 BRANCH=ToT TEST=Verified on Samus. cd /sys/bus/iio/devices/iio:device0 cat *peak_scale Change-Id: I2b0606e55bfa5e498255c6c42240ee3f9236e4f1 Signed-off-by: Sheng-Liang Song <ssl@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220991 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/motion_sense.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c
index f157838f12..12d893f826 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -432,29 +432,28 @@ static struct motion_sensor_t
for (i = 0; i < motion_sensor_count; ++i) {
+ sensor = &motion_sensors[i];
+
if ((LOCATION_BASE == sensor->location)
&& (SENSOR_ACCELEROMETER == sensor->type)
&& (host_id == EC_MOTION_SENSOR_ACCEL_BASE)) {
- sensor = &motion_sensors[i];
break;
}
if ((LOCATION_LID == sensor->location)
&& (SENSOR_ACCELEROMETER == sensor->type)
&& (host_id == EC_MOTION_SENSOR_ACCEL_LID)) {
- sensor = &motion_sensors[i];
break;
}
if ((LOCATION_BASE == sensor->location)
&& (SENSOR_GYRO == sensor->type)
&& (host_id == EC_MOTION_SENSOR_GYRO)) {
- sensor = &motion_sensors[i];
break;
}
}
- if (!sensor)
+ if (i == motion_sensor_count)
return NULL;
if ((sensor->power == SENSOR_POWER_ON)