lkml.org 
[lkml]   [2020]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 1/1] checks: mask flags bit when check i2c addr
Date
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
\
 
 \ /
  Last update: 2020-03-26 06:45    [W:0.042 / U:2.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site