summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorKarthikeyan Ramasubramanian <kramasub@chromium.org>2018-10-22 09:06:09 -0600
committerJustin TerAvest <teravest@chromium.org>2018-10-23 03:49:47 +0000
commita9b454f3f8f28bf4bb556d9467c730b255af329b (patch)
treeca52f6f389b72125ac09a92f5aca0ba493e0f7d5 /driver
parenta6e01d0c4db79f27fb55d9b77465d923fe82eb3b (diff)
downloadchrome-ec-a9b454f3f8f28bf4bb556d9467c730b255af329b.tar.gz
drivers/accelgyro_lsm6dsm: Fix the FIFO_NUM_DEV configuration
Adding FIFO_DEV_MAG increases the number of motion sensors in the FIFO data set. In the boards where magnetometer is not present, this causes fifo_enable function to perform an out of bound memory access and lead to a crash. Update the number of motion sensors with FIFO_DEV_MAG only in the boards where magnetometer is present. BRANCH=None TEST=bootup to ChromeOS in grabbiter and meep. BUG=b:118083418 Change-Id: I77ce059cb05b429eff84d69c29081c8042fc2c51 Signed-off-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1293889 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/accelgyro_lsm6dsm.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/driver/accelgyro_lsm6dsm.h b/driver/accelgyro_lsm6dsm.h
index afb669c077..6e603e6df5 100644
--- a/driver/accelgyro_lsm6dsm.h
+++ b/driver/accelgyro_lsm6dsm.h
@@ -147,7 +147,9 @@ enum dev_fifo {
FIFO_DEV_INVALID = -1,
FIFO_DEV_GYRO = 0,
FIFO_DEV_ACCEL,
+#ifdef CONFIG_MAG_LIS2MDL
FIFO_DEV_MAG,
+#endif
FIFO_DEV_NUM,
};