summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/ov23850.c
diff options
context:
space:
mode:
authorWenjia Zhou <wenjiaz@nvidia.com>2017-02-17 21:00:40 -0500
committerBhanu Murthy V <bmurthyv@nvidia.com>2017-03-22 13:38:29 -0400
commit6cb1e4413847fb0ee64bd815d9cde7aae1d61cf1 (patch)
tree896d12fe0aeb1773bc8e36a8fa051c335ab6a0bc /drivers/media/i2c/ov23850.c
parent3f1a4170d75511d8e92c988d27f5e955fb75ff2c (diff)
media:i2c: fix coverity defects
Fixed out of bound access Fixed wrong shift value to compute gain Coverity ID 29587 Coverity ID 36185 Bug 200192387 Change-Id: I60999628c38192c41ce7e75099b65643d7476f2c Signed-off-by: Wenjia Zhou <wenjiaz@nvidia.com> Reviewed-on: http://git-master/r/1307363 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Shubham Chandra <shubhamc@nvidia.com> Reviewed-by: Frank Chen <frankc@nvidia.com> Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Bhanu Murthy V <bmurthyv@nvidia.com>
Diffstat (limited to 'drivers/media/i2c/ov23850.c')
-rw-r--r--drivers/media/i2c/ov23850.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/i2c/ov23850.c b/drivers/media/i2c/ov23850.c
index 141287d8e..bad408019 100644
--- a/drivers/media/i2c/ov23850.c
+++ b/drivers/media/i2c/ov23850.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * ov23850.c - ov23850 sensor driver 2 * ov23850.c - ov23850 sensor driver
3 * 3 *
4 * Copyright (c) 2013-2016, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2013-2017, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -252,7 +252,7 @@ static inline void ov23850_get_gain_reg(ov23850_reg *regs,
252 u16 gain) 252 u16 gain)
253{ 253{
254 regs->addr = OV23850_GAIN_ADDR_MSB; 254 regs->addr = OV23850_GAIN_ADDR_MSB;
255 regs->val = (gain >> 16) & 0x07; 255 regs->val = (gain >> 8) & 0x07;
256 (regs + 1)->addr = OV23850_GAIN_ADDR_LSB; 256 (regs + 1)->addr = OV23850_GAIN_ADDR_LSB;
257 (regs + 1)->val = (gain) & 0xff; 257 (regs + 1)->val = (gain) & 0xff;
258} 258}