summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2018-12-14 15:31:59 -0700
committerCommit Bot <commit-bot@chromium.org>2022-03-10 04:36:14 +0000
commitd1d2aeb01fda2c069c7cdb543b5e0fbcbe755613 (patch)
tree53db607d0eead64b13f5d712af05266d70d181fd
parent646ba68aa0d38b9b6f993f76897bafe1a82c06d4 (diff)
downloadchrome-ec-d1d2aeb01fda2c069c7cdb543b5e0fbcbe755613.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> (cherry picked from commit 4d15f8668fbadac39604c6e015a86c1634162584) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3515353 Reviewed-by: Ricardo Quesada <ricardoq@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@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 4468e6f6b4..b1652e4b05 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