[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20200326054345.9806-1-rayagonda.kokatanur@broadcom.com>
Date: Thu, 26 Mar 2020 11:13:45 +0530
From: Rayagonda Kokatanur <rayagonda.kokatanur@...adcom.com>
To: Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
bcm-kernel-feedback-list@...adcom.com
Cc: Rayagonda Kokatanur <rayagonda.kokatanur@...adcom.com>
Subject: [PATCH v1 1/1] checks: mask flags bit when check i2c addr
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@...adcom.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
Powered by blists - more mailing lists