浏览代码

i2c: qup: off by ones in qup_i2c_probe()

These should ">= ARRAY_SIZE()" instead of "> ARRAY_SIZE()".

Fixes: 10c5a8425968 ('i2c: qup: New bus driver for the Qualcomm QUP I2C controller')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Dan Carpenter 11 年之前
父节点
当前提交
199c1df28d
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      drivers/i2c/busses/i2c-qup.c

+ 2 - 2
drivers/i2c/busses/i2c-qup.c

@@ -633,12 +633,12 @@ static int qup_i2c_probe(struct platform_device *pdev)
 	 * associated with each byte written/received
 	 * associated with each byte written/received
 	 */
 	 */
 	size = QUP_OUTPUT_BLOCK_SIZE(io_mode);
 	size = QUP_OUTPUT_BLOCK_SIZE(io_mode);
-	if (size > ARRAY_SIZE(blk_sizes))
+	if (size >= ARRAY_SIZE(blk_sizes))
 		return -EIO;
 		return -EIO;
 	qup->out_blk_sz = blk_sizes[size] / 2;
 	qup->out_blk_sz = blk_sizes[size] / 2;
 
 
 	size = QUP_INPUT_BLOCK_SIZE(io_mode);
 	size = QUP_INPUT_BLOCK_SIZE(io_mode);
-	if (size > ARRAY_SIZE(blk_sizes))
+	if (size >= ARRAY_SIZE(blk_sizes))
 		return -EIO;
 		return -EIO;
 	qup->in_blk_sz = blk_sizes[size] / 2;
 	qup->in_blk_sz = blk_sizes[size] / 2;