summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform
diff options
context:
space:
mode:
authorBenoit Parrot2016-02-19 20:24:45 +0100
committerMauro Carvalho Chehab2016-02-23 11:17:07 +0100
commit7f67c587cfd9d27cfcaa22a545f6a999432aa023 (patch)
treee1e538d5b8835fa23cd5876defbe764f536619b7 /drivers/media/platform
parent[media] dib0090: do the right thing if rf_ramp is NULL (diff)
downloadkernel-qcow2-linux-7f67c587cfd9d27cfcaa22a545f6a999432aa023.tar.gz
kernel-qcow2-linux-7f67c587cfd9d27cfcaa22a545f6a999432aa023.tar.xz
kernel-qcow2-linux-7f67c587cfd9d27cfcaa22a545f6a999432aa023.zip
[media] media: ti-vpe: cal: Fix unreachable code in enum_frame_interval
As reported, the current cal_enum_frameintervals() is confusing and does not have the intended behavior. Fix this by re-implementing to properly propagate the enum_frame_interval request to the subdevice. [mchehab@osg.samsung.com: remove a now bogus "ret = 0" statement] Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Reported-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r--drivers/media/platform/ti-vpe/cal.c41
1 files changed, 12 insertions, 29 deletions
diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c
index 35fa1071c5b2..272ef8b49feb 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -1201,42 +1201,25 @@ static int cal_enum_frameintervals(struct file *file, void *priv,
{
struct cal_ctx *ctx = video_drvdata(file);
const struct cal_fmt *fmt;
- struct v4l2_subdev_frame_size_enum fse;
+ struct v4l2_subdev_frame_interval_enum fie = {
+ .index = fival->index,
+ .width = fival->width,
+ .height = fival->height,
+ .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+ };
int ret;
- if (fival->index)
- return -EINVAL;
-
fmt = find_format_by_pix(ctx, fival->pixel_format);
if (!fmt)
return -EINVAL;
- /* check for valid width/height */
- ret = 0;
- fse.pad = 0;
- fse.code = fmt->code;
- fse.which = V4L2_SUBDEV_FORMAT_ACTIVE;
- for (fse.index = 0; ; fse.index++) {
- ret = v4l2_subdev_call(ctx->sensor, pad, enum_frame_size,
- NULL, &fse);
- if (ret)
- return -EINVAL;
-
- if ((fival->width == fse.max_width) &&
- (fival->height == fse.max_height))
- break;
- else if ((fival->width >= fse.min_width) &&
- (fival->width <= fse.max_width) &&
- (fival->height >= fse.min_height) &&
- (fival->height <= fse.max_height))
- break;
-
- return -EINVAL;
- }
-
+ fie.code = fmt->code;
+ ret = v4l2_subdev_call(ctx->sensor, pad, enum_frame_interval,
+ NULL, &fie);
+ if (ret)
+ return ret;
fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
- fival->discrete.numerator = 1;
- fival->discrete.denominator = 30;
+ fival->discrete = fie.interval;
return 0;
}