[linux-yocto] [PATCH 04/19] i2c: check for proper length of the reg property

Saul Wold sgw at linux.intel.com
Mon Feb 8 14:10:13 PST 2016


From: Wolfram Sang <wsa+renesas at sang-engineering.com>

commit bc280e47bc3944af5c7ca3cebaaf07819805ecb6 upstream.

int is vague, let's simply use the type of the variable in question.

Signed-off-by: Wolfram Sang <wsa+renesas at sang-engineering.com>
Reviewed-by: Simon Horman <horms+renesas at verge.net.au>
Signed-off-by: Wolfram Sang <wsa at the-dreams.de>
(cherry picked from commit 4c1344f105b626c222ea64669dc6dcfe100ccf3b)
---
 drivers/i2c/i2c-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 77a2ec6..bfd8e1c 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1276,7 +1276,7 @@ static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap,
 	}
 
 	addr = of_get_property(node, "reg", &len);
-	if (!addr || (len < sizeof(int))) {
+	if (!addr || (len < sizeof(*addr))) {
 		dev_err(&adap->dev, "of_i2c: invalid reg on %s\n",
 			node->full_name);
 		return ERR_PTR(-EINVAL);
-- 
2.5.0



More information about the linux-yocto mailing list