124b7ae7427eaacbceae9133d5dbe724ce9582d0
[openwrt/openwrt.git] /
1 From 6680d139ee23cf655c0aa43581604a7c5de31803 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Fri, 13 Sep 2019 17:23:26 +0100
4 Subject: [PATCH] staging: bcm2835-codec: Set default and error check
5 timeperframe
6
7 G_PARM default was invalid as 0/0, and the driver didn't check
8 the value set in S_PARM wasn't 0/0.
9
10 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
11 ---
12 .../vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c | 7 +++++++
13 1 file changed, 7 insertions(+)
14
15 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
16 +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
17 @@ -1423,6 +1423,10 @@ static int vidioc_s_parm(struct file *fi
18 if (parm->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
19 return -EINVAL;
20
21 + if (!parm->parm.output.timeperframe.denominator ||
22 + !parm->parm.output.timeperframe.numerator)
23 + return -EINVAL;
24 +
25 ctx->framerate_num =
26 parm->parm.output.timeperframe.denominator;
27 ctx->framerate_denom =
28 @@ -2390,6 +2394,9 @@ static int bcm2835_codec_open(struct fil
29 ctx->colorspace = V4L2_COLORSPACE_REC709;
30 ctx->bitrate = 10 * 1000 * 1000;
31
32 + ctx->framerate_num = 30;
33 + ctx->framerate_denom = 1;
34 +
35 /* Initialise V4L2 contexts */
36 v4l2_fh_init(&ctx->fh, video_devdata(file));
37 file->private_data = &ctx->fh;