summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/ov9640.c
diff options
context:
space:
mode:
authorPetr Cvek <petrcvekcz@gmail.com>2018-12-13 10:39:16 -0500
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-01-16 13:31:12 -0500
commit74d01576fc85a5a5e7ea8c4de276c7db0d6abc1a (patch)
tree22ce4decbcb1ec630831c65c23a64733b8ad0e74 /drivers/media/i2c/ov9640.c
parentf8de593d5348259c25bb383e80698213b9af4ff0 (diff)
downloadlinux-stable-74d01576fc85a5a5e7ea8c4de276c7db0d6abc1a.tar.gz
linux-stable-74d01576fc85a5a5e7ea8c4de276c7db0d6abc1a.tar.bz2
linux-stable-74d01576fc85a5a5e7ea8c4de276c7db0d6abc1a.zip
media: i2c: ov9640: change array index or length variables to unsigned
The driver uses variables to store frame resolutions and to indexing various arrays. These should be unsigned. Signed-off-by: Petr Cvek <petrcvekcz@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/i2c/ov9640.c')
-rw-r--r--drivers/media/i2c/ov9640.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/media/i2c/ov9640.c b/drivers/media/i2c/ov9640.c
index 9a6fa609e8c4..08f3f8247759 100644
--- a/drivers/media/i2c/ov9640.c
+++ b/drivers/media/i2c/ov9640.c
@@ -347,10 +347,10 @@ static int ov9640_s_power(struct v4l2_subdev *sd, int on)
/* select nearest higher resolution for capture */
static void ov9640_res_roundup(u32 *width, u32 *height)
{
- int i;
+ unsigned int i;
enum { QQCIF, QQVGA, QCIF, QVGA, CIF, VGA, SXGA };
- static const int res_x[] = { 88, 160, 176, 320, 352, 640, 1280 };
- static const int res_y[] = { 72, 120, 144, 240, 288, 480, 960 };
+ static const u32 res_x[] = { 88, 160, 176, 320, 352, 640, 1280 };
+ static const u32 res_y[] = { 72, 120, 144, 240, 288, 480, 960 };
for (i = 0; i < ARRAY_SIZE(res_x); i++) {
if (res_x[i] >= *width && res_y[i] >= *height) {
@@ -393,8 +393,9 @@ static int ov9640_write_regs(struct i2c_client *client, u32 width,
u32 code, struct ov9640_reg_alt *alts)
{
const struct ov9640_reg *ov9640_regs, *matrix_regs;
- int ov9640_regs_len, matrix_regs_len;
- int i, ret;
+ unsigned int ov9640_regs_len, matrix_regs_len;
+ unsigned int i;
+ int ret;
u8 val;
/* select register configuration for given resolution */
@@ -479,7 +480,8 @@ static int ov9640_write_regs(struct i2c_client *client, u32 width,
/* program default register values */
static int ov9640_prog_dflt(struct i2c_client *client)
{
- int i, ret;
+ unsigned int i;
+ int ret;
for (i = 0; i < ARRAY_SIZE(ov9640_regs_dflt); i++) {
ret = ov9640_reg_write(client, ov9640_regs_dflt[i].reg,