[coreboot-gerrit] New patch to review for coreboot: cpu/allwinner/a10: Fix I2c speed calculation
Martin Roth (martinroth@google.com)
gerrit at coreboot.org
Mon Dec 21 20:52:09 CET 2015
Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12779
-gerrit
commit 80e09cbb309bc8afaadf5af11e2b16225de818ba
Author: Martin Roth <martinroth at google.com>
Date: Mon Dec 21 12:51:40 2015 -0700
cpu/allwinner/a10: Fix I2c speed calculation
Looking at the A10 datasheet, N should go in bits 2:0, but
was being cleared by shifting it left by three bits, then
anding it with 7.
Fixes coverity warning:
CID 1241888 (#1 of 1): Wrong operator used (CONSTANT_EXPRESSION_RESULT)
operator_confusion: (n << 3) & (7U /* 7 << 0 */) is always 0 regardless
of the values of its operands. This occurs as the bitwise second operand
of '|'.
Change-Id: I17e71a73adf37a62607e8e5865b1da749d7278aa
Signed-off-by: Martin Roth <martinroth at google.com>
---
src/cpu/allwinner/a10/twi.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cpu/allwinner/a10/twi.h b/src/cpu/allwinner/a10/twi.h
index c5f2974..3dbb302 100644
--- a/src/cpu/allwinner/a10/twi.h
+++ b/src/cpu/allwinner/a10/twi.h
@@ -39,7 +39,7 @@ enum twi_status {
#define TWI_CLK_M_MASK (0xf << 3)
#define TWI_CLK_M(m) (((m - 1) << 3) & TWI_CLK_M_MASK)
#define TWI_CLK_N_MASK (0x7 << 0)
-#define TWI_CLK_N(n) (((n) << 3) & TWI_CLK_N_MASK)
+#define TWI_CLK_N(n) ((n) & TWI_CLK_N_MASK)
struct a1x_twi {
u32 addr; /**< 0x00: Slave address */
More information about the coreboot-gerrit
mailing list