i2c: octeon: check correct size of maximum RECV_LEN packet
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Sat, 9 Jan 2021 12:43:08 +0000 (13:43 +0100)
committerWolfram Sang <wsa@kernel.org>
Sun, 17 Jan 2021 11:26:55 +0000 (12:26 +0100)
I2C_SMBUS_BLOCK_MAX defines already the maximum number as defined in the
SMBus 2.0 specs. No reason to add one to it.

Fixes: 886f6f8337dd ("i2c: octeon: Support I2C_M_RECV_LEN")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Robert Richter <rric@kernel.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-octeon-core.c

index d9607905dc2f1dd0db15c6ca457ebc445921d829..845eda70b8cab52a0453c9f4cb545010fba4305d 100644 (file)
@@ -347,7 +347,7 @@ static int octeon_i2c_read(struct octeon_i2c *i2c, int target,
                if (result)
                        return result;
                if (recv_len && i == 0) {
-                       if (data[i] > I2C_SMBUS_BLOCK_MAX + 1)
+                       if (data[i] > I2C_SMBUS_BLOCK_MAX)
                                return -EPROTO;
                        length += data[i];
                }