]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
i2c: tegra: report error if i2c msg length > 4096
authorShardar Shariff Md <smohammed@nvidia.com>
Fri, 23 Jan 2015 15:09:09 +0000 (20:39 +0530)
committerLaxman Dewangan <ldewangan@nvidia.com>
Mon, 26 Jan 2015 15:43:44 +0000 (07:43 -0800)
report error if i2c message length is more than
supported size 4096

Bug 200074217

Change-Id: I2e2f094ba486c87e7e573649d7fad7b6f8dd6c09
Signed-off-by: Shardar Shariff Md <smohammed@nvidia.com>
Reviewed-on: http://git-master/r/676982
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
drivers/i2c/busses/i2c-tegra.c

index 32bd52a2c153f3da612664087170350824e96181..02a4077708b930231a35580fa1d2bcdac768eed4 100644 (file)
@@ -1265,6 +1265,14 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
        if (adap->atomic_xfer_only)
                return -EBUSY;
 
+       for (i = 0; i < num; i++) {
+               if (msgs[i].len > 4096) {
+                       dev_err(i2c_dev->dev, "msg len %d not supported, supports upto 4096\n",
+                                       msgs[i].len);
+                       return -EINVAL;
+               }
+       }
+
        i2c_dev->msgs = msgs;
        i2c_dev->msgs_num = num;