diff options
author | Paul Ma <magf@bitland.corp-partner.google.com> | 2019-10-24 09:56:48 +0800 |
---|---|---|
committer | Justin TerAvest <teravest@chromium.org> | 2019-10-25 02:25:23 +0000 |
commit | 16275bb36d338dd952b9312450c0cee110d5468c (patch) | |
tree | 6da000a9b59bdd3701163354d36768685985b870 /test/console_edit.tasklist | |
parent | 4f602a98a0bb518378dbbf2e42f7a2e2f979516e (diff) | |
download | chrome-ec-16275bb36d338dd952b9312450c0cee110d5468c.tar.gz |
driver: lis2dw12/lis2dwl: fix wrong __fls usage
__fls(n) is defined as (31 - __builtin_clz(n)) in include/common.h.
Because of the definition, n can't be 0. When n is 0, __fls(0)
will be -1 and it is a wrong result.
Since sensor data rate can be set lower than LIS2DW12_ODR_MIN_VAL,
it is possible for __fls() to get a 0 parameter. This CL will fix
this condition.
Because macros are getting complex, move them to c file and convert
to functions.
BUG=b:143242489
BRANCH=none
TEST=run 'suspend_stress_test --suspend_min=10 --wake_min=10 \
--count=2500' on DUTs, test pass and no EC crash.
Change-Id: I46febb602b47624ba5d0106abaedd34a23ebe96f
Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1876297
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'test/console_edit.tasklist')
0 files changed, 0 insertions, 0 deletions