You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2021/03/01 06:47:30 UTC
[mynewt-core] 08/19: sensors/lsm6dso: Fix operands don't affect
result
This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 59ba308257ee07cf93516149f81a55f009f002e3
Author: Magdalena Kasenberg <ma...@codecoup.pl>
AuthorDate: Wed Feb 24 13:05:41 2021 +0100
sensors/lsm6dso: Fix operands don't affect result
Setting reg LSM6DSO_TAP_CFG2_ADDR and LSM6DSO_TAP_CFG1_ADDR was not taking
into account bit field positions.
Coverity issue 204211.
---
hw/drivers/sensors/lsm6dso/src/lsm6dso.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/drivers/sensors/lsm6dso/src/lsm6dso.c b/hw/drivers/sensors/lsm6dso/src/lsm6dso.c
index 6616a03..fae1699 100644
--- a/hw/drivers/sensors/lsm6dso/src/lsm6dso.c
+++ b/hw/drivers/sensors/lsm6dso/src/lsm6dso.c
@@ -1141,15 +1141,15 @@ int lsm6dso_set_tap_cfg(struct sensor_itf *itf,
}
reg &= ~LSM6DSO_TAP_THS_Y_MASK;
- reg |= cfg->tap_ths & LSM6DSO_TAP_THS_Y_MASK;
+ reg |= LSM6DSO_SHIFT_DATA_MASK(cfg->tap_ths, LSM6DSO_TAP_THS_Y_MASK);
rc = lsm6dso_writelen(itf, LSM6DSO_TAP_CFG2_ADDR, ®, 1);
if (rc) {
return rc;
}
- reg = cfg->tap_ths & LSM6DSO_TAP_THS_X_MASK;
- reg |= cfg->tap_prio & LSM6DSO_TAP_PRIORITY_MASK;
+ reg = LSM6DSO_SHIFT_DATA_MASK(cfg->tap_ths, LSM6DSO_TAP_THS_X_MASK);
+ reg |= LSM6DSO_SHIFT_DATA_MASK(cfg->tap_prio, LSM6DSO_TAP_PRIORITY_MASK);
rc = lsm6dso_writelen(itf, LSM6DSO_TAP_CFG1_ADDR, ®, 1);
if (rc) {