summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2018-12-14 15:31:59 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-12-14 22:40:29 -0800
commit4d15f8668fbadac39604c6e015a86c1634162584 (patch)
treefe63148e6969084745ef7211ad96a72f8efabec4
parenta44961d6cacaab72fd4159a739997dfbe78fd6dc (diff)
downloadchrome-ec-4d15f8668fbadac39604c6e015a86c1634162584.tar.gz
bmi160: exit IRQ loop if error during reg read
The IRQ handler for bmi160 continues to loop until all of the interrupt reasons are handled; however, if the read fails the interrupt variable will be in an unknown state. We can either return early if there was an error or we can set the interrupt variable to 0 before the read call. Either way the loop exits. BRANCH=none BUG=b:119093572 TEST=On Bobba360 with a solid repro case of the watchdog reset, this change avoids the watchdog reset. Change-Id: I482f074b6e9e7c183def8ce17157ed28ca96b1c9 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1378908 Reviewed-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: Enrico Granata <egranata@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r--driver/accelgyro_bmi160.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c
index 1b096c9f50..f573a463e4 100644
--- a/driver/accelgyro_bmi160.c
+++ b/driver/accelgyro_bmi160.c
@@ -1116,8 +1116,10 @@ static int irq_handler(struct motion_sensor_t *s, uint32_t *event)
do {
rv = raw_read32(s->port, s->addr, BMI160_INT_STATUS_0,
&interrupt);
- /* Bail out of this loop if the sensor isn't powered. */
- if (rv == EC_ERROR_NOT_POWERED)
+ /*
+ * Bail out of this loop there was an error reading the register
+ */
+ if (rv)
return rv;
#ifdef CONFIG_GESTURE_SENSOR_BATTERY_TAP