i2c: check for proper length of the reg property
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Tue, 19 May 2015 16:29:48 +0000 (18:29 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Sun, 31 May 2015 23:22:51 +0000 (08:22 +0900)
int is vague, let's simply use the type of the variable in question.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/i2c-core.c

index 2a627eb0365b519a02e2e42c98f989c4eefe0a77..b8f11b82485cd35ab7cf78fdd7326930ed478421 100644 (file)
@@ -1272,7 +1272,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);