X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fmedia%2Fvideo%2Fov7670.c;h=ea032f5f2f412ff2fae9eb6fa1535ad045e94ede;hb=6638101c1124c19c8a65b1645e4ecd09e0572f3e;hp=d7bfd30f74a9bed8455d8c69859f83becc4f2471;hpb=61d97f4fcf73d30864a52373a34093be25be6a03;p=linux-2.6-omap-h63xx.git diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index d7bfd30f74a..ea032f5f2f4 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c @@ -682,17 +682,17 @@ static int ov7670_try_fmt(struct i2c_client *c, struct v4l2_format *fmt, for (index = 0; index < N_OV7670_FMTS; index++) if (ov7670_formats[index].pixelformat == pix->pixelformat) break; - if (index >= N_OV7670_FMTS) - return -EINVAL; + if (index >= N_OV7670_FMTS) { + /* default to first format */ + index = 0; + pix->pixelformat = ov7670_formats[0].pixelformat; + } if (ret_fmt != NULL) *ret_fmt = ov7670_formats + index; /* * Fields: the OV devices claim to be progressive. */ - if (pix->field == V4L2_FIELD_ANY) - pix->field = V4L2_FIELD_NONE; - else if (pix->field != V4L2_FIELD_NONE) - return -EINVAL; + pix->field = V4L2_FIELD_NONE; /* * Round requested image size down to the nearest * we support, but not below the smallest. @@ -833,7 +833,7 @@ static int ov7670_store_cmatrix(struct i2c_client *client, int matrix[CMATRIX_LEN]) { int i, ret; - unsigned char signbits; + unsigned char signbits = 0; /* * Weird crap seems to exist in the upper part of @@ -1009,7 +1009,7 @@ static unsigned char ov7670_abs_to_sm(unsigned char v) static int ov7670_t_brightness(struct i2c_client *client, int value) { - unsigned char com8, v; + unsigned char com8 = 0, v; int ret; ov7670_read(client, REG_COM8, &com8); @@ -1022,7 +1022,7 @@ static int ov7670_t_brightness(struct i2c_client *client, int value) static int ov7670_q_brightness(struct i2c_client *client, __s32 *value) { - unsigned char v; + unsigned char v = 0; int ret = ov7670_read(client, REG_BRIGHT, &v); *value = ov7670_sm_to_abs(v); @@ -1036,7 +1036,7 @@ static int ov7670_t_contrast(struct i2c_client *client, int value) static int ov7670_q_contrast(struct i2c_client *client, __s32 *value) { - unsigned char v; + unsigned char v = 0; int ret = ov7670_read(client, REG_CONTRAS, &v); *value = v; @@ -1046,7 +1046,7 @@ static int ov7670_q_contrast(struct i2c_client *client, __s32 *value) static int ov7670_q_hflip(struct i2c_client *client, __s32 *value) { int ret; - unsigned char v; + unsigned char v = 0; ret = ov7670_read(client, REG_MVFP, &v); *value = (v & MVFP_MIRROR) == MVFP_MIRROR; @@ -1056,7 +1056,7 @@ static int ov7670_q_hflip(struct i2c_client *client, __s32 *value) static int ov7670_t_hflip(struct i2c_client *client, int value) { - unsigned char v; + unsigned char v = 0; int ret; ret = ov7670_read(client, REG_MVFP, &v); @@ -1074,7 +1074,7 @@ static int ov7670_t_hflip(struct i2c_client *client, int value) static int ov7670_q_vflip(struct i2c_client *client, __s32 *value) { int ret; - unsigned char v; + unsigned char v = 0; ret = ov7670_read(client, REG_MVFP, &v); *value = (v & MVFP_FLIP) == MVFP_FLIP; @@ -1084,7 +1084,7 @@ static int ov7670_q_vflip(struct i2c_client *client, __s32 *value) static int ov7670_t_vflip(struct i2c_client *client, int value) { - unsigned char v; + unsigned char v = 0; int ret; ret = ov7670_read(client, REG_MVFP, &v);