summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/saa717x.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-28 10:28:13 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-30 13:35:13 -0300
commit4c7ba4082f903c2df3801a26bf3199544c081830 (patch)
treeb085aa89c5b8b4de655b12175b3fc70c545268ee /drivers/media/i2c/saa717x.c
parent3c71d978c5e6dadfc798e84290014f713f56c97b (diff)
downloadlinux-stable-4c7ba4082f903c2df3801a26bf3199544c081830.tar.gz
linux-stable-4c7ba4082f903c2df3801a26bf3199544c081830.tar.bz2
linux-stable-4c7ba4082f903c2df3801a26bf3199544c081830.zip
[media] saa717x: fix multi-byte read code
As reported by smatch: drivers/media/i2c/saa717x.c:155 saa717x_read() warn: mask and shift to zero drivers/media/i2c/saa717x.c:155 saa717x_read() warn: mask and shift to zero This is done right at saa717x_write(), but the read function is broken. Thankfully, there's just one place at saa717x driver that uses multibyte read (for status report, via printk). Yet, let's fix it. From saa717x_write(), it is clear that the bytes are in little endian: mm1[4] = (value >> 16) & 0xff; mm1[3] = (value >> 8) & 0xff; mm1[2] = value & 0xff; So, the same order should be valid for read too. Compile-tested only. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/i2c/saa717x.c')
-rw-r--r--drivers/media/i2c/saa717x.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/i2c/saa717x.c b/drivers/media/i2c/saa717x.c
index 0d0f9a917cd3..17557b2f1b09 100644
--- a/drivers/media/i2c/saa717x.c
+++ b/drivers/media/i2c/saa717x.c
@@ -152,9 +152,9 @@ static u32 saa717x_read(struct v4l2_subdev *sd, u32 reg)
i2c_transfer(adap, msgs, 2);
if (fw_addr)
- value = (mm2[2] & 0xff) | ((mm2[1] & 0xff) >> 8) | ((mm2[0] & 0xff) >> 16);
+ value = (mm2[2] << 16) | (mm2[1] << 8) | mm2[0];
else
- value = mm2[0] & 0xff;
+ value = mm2[0];
v4l2_dbg(2, debug, sd, "read: reg 0x%03x=0x%08x\n", reg, value);
return value;