diff options
-rw-r--r-- | drivers/i2c/i2c-core.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index b55097d57b7a..9583a54ce16b 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -864,7 +864,7 @@ static int i2c_smbus_add_pec(u16 addr, u8 command, int size, | |||
864 | break; | 864 | break; |
865 | case I2C_SMBUS_BYTE_DATA: | 865 | case I2C_SMBUS_BYTE_DATA: |
866 | buf[2] = data->byte; | 866 | buf[2] = data->byte; |
867 | data->word = buf[2] || | 867 | data->word = buf[2] | |
868 | (i2c_smbus_pec(3, buf, NULL) << 8); | 868 | (i2c_smbus_pec(3, buf, NULL) << 8); |
869 | size = I2C_SMBUS_WORD_DATA; | 869 | size = I2C_SMBUS_WORD_DATA; |
870 | break; | 870 | break; |
@@ -1033,8 +1033,8 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | |||
1033 | need to use only one message; when reading, we need two. We initialize | 1033 | need to use only one message; when reading, we need two. We initialize |
1034 | most things with sane defaults, to keep the code below somewhat | 1034 | most things with sane defaults, to keep the code below somewhat |
1035 | simpler. */ | 1035 | simpler. */ |
1036 | unsigned char msgbuf0[34]; | 1036 | unsigned char msgbuf0[I2C_SMBUS_BLOCK_MAX+3]; |
1037 | unsigned char msgbuf1[34]; | 1037 | unsigned char msgbuf1[I2C_SMBUS_BLOCK_MAX+2]; |
1038 | int num = read_write == I2C_SMBUS_READ?2:1; | 1038 | int num = read_write == I2C_SMBUS_READ?2:1; |
1039 | struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, | 1039 | struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, |
1040 | { addr, flags | I2C_M_RD, 0, msgbuf1 } | 1040 | { addr, flags | I2C_M_RD, 0, msgbuf1 } |
@@ -1097,7 +1097,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, | |||
1097 | } | 1097 | } |
1098 | if(size == I2C_SMBUS_BLOCK_DATA_PEC) | 1098 | if(size == I2C_SMBUS_BLOCK_DATA_PEC) |
1099 | (msg[0].len)++; | 1099 | (msg[0].len)++; |
1100 | for (i = 1; i <= msg[0].len; i++) | 1100 | for (i = 1; i < msg[0].len; i++) |
1101 | msgbuf0[i] = data->block[i-1]; | 1101 | msgbuf0[i] = data->block[i-1]; |
1102 | } | 1102 | } |
1103 | break; | 1103 | break; |