summaryrefslogtreecommitdiff
path: root/include/driver
diff options
context:
space:
mode:
authorTomasz Michalec <tm@semihalf.com>2021-06-09 21:52:27 +0200
committerCommit Bot <commit-bot@chromium.org>2021-06-30 08:50:14 +0000
commit3a344a6f32720b6156c763403cf32941067c3464 (patch)
treef3f940cbe0105d76cb70dbf2cdd8918979c3884c /include/driver
parent93c8503f4ba5fefc7c7a2a2d3db4b46f25a79de7 (diff)
downloadchrome-ec-3a344a6f32720b6156c763403cf32941067c3464.tar.gz
driver: Add argument check in BMA2x2 driver
set_range and set_data_rate functions of BMA2x2 driver should check input values to not set values outside of range supported by device. BUG=none BRANCH=none TEST=makeall Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Ie9650975e00a99e86a5229ee200dab24be536076 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2953222 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'include/driver')
-rw-r--r--include/driver/accel_bma2x2.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/driver/accel_bma2x2.h b/include/driver/accel_bma2x2.h
index d93b068f20..3a46c7c050 100644
--- a/include/driver/accel_bma2x2.h
+++ b/include/driver/accel_bma2x2.h
@@ -61,6 +61,7 @@
#define BMA2x2_BW_500HZ 0x0E /* LowPass 500HZ */
#define BMA2x2_BW_1000HZ 0x0F /* LowPass 1000HZ */
+/* Do not use BW lower than 7813, because __fls cannot be call for 0 */
#define BMA2x2_BW_TO_REG(_bw) \
((_bw) < 125000 ? \
BMA2x2_BW_7_81HZ + __fls(((_bw) * 10) / 78125) : \