Messages in this thread Patch in this message | | | From | Rayagonda Kokatanur <> | Subject | [PATCH v1 1/1] checks: mask flags bit when check i2c addr | Date | Thu, 26 Mar 2020 11:13:45 +0530 |
| |
Generally i2c addr should not be greater than 10-bit. The highest bytes are used for other purpose, for ex 2 bits are used for I2C_TEN_BIT_ADDRESS and I2C_OWN_SLAVE_ADDRESS. Hence mask upper bytes if check slave addr valid.
Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> --- checks.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/checks.c b/checks.c index 8acbc05..5c7f2b1 100644 --- a/checks.c +++ b/checks.c @@ -1051,6 +1051,12 @@ static void check_i2c_bus_reg(struct check *c, struct dt_info *dti, struct node for (len = prop->val.len; len > 0; len -= 4) { reg = fdt32_to_cpu(*(cells++)); + /* + * The highest bytes are used for other purpose, for ex 2 bits + * are used for I2C_TEN_BIT_ADDRESS and I2C_OWN_SLAVE_ADDRESS. + * Hence mask upper bytes if check slave addr valid. + */ + reg &= ~0xFF000000; if (reg > 0x3ff) FAIL_PROP(c, dti, node, prop, "I2C address must be less than 10-bits, got \"0x%x\"", reg); -- 2.17.1
| |