summaryrefslogtreecommitdiff
path: root/src/drivers/maxim
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2020-04-15 20:54:14 +0800
committerPatrick Georgi <pgeorgi@google.com>2020-04-20 06:20:50 +0000
commit85ecdb1471dd695997166f447f786ed500d091b9 (patch)
tree19955f93d8ee0872a57b389c7bf1cff11d5bd518 /src/drivers/maxim
parent38e386f2d0255fdc424b0efe73585ea4ab9e8b1b (diff)
mmio: Fix failure in bit field macro when accessing >30 bits
For bit fields with 31 bits (e.g: DEFINE_BITFIELD(MYREG, 30, 0) ), the calculation of mask value will go overflow: "error: integer overflow in expression '-2147483648 - 1' of type 'int' results in '2147483647'". And for bit fields with 32 bits (e.g: DEFINE_BITFIELD(MYREG, 31, 0) ), the error will be: "error: left shift count >= width of type [-Werror=shift-count-overflow]" To fix these issues, the bit field macros should always use unsigned integers, and use 64bit integer when creating mask value. Change-Id: Ie3cddf9df60b83de4e21243bfde6b79729fb06ef Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/40404 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/drivers/maxim')
0 files changed, 0 insertions, 0 deletions