aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-4.19/950-0744-staging-bcm2835-codec-Set-default-and-error-check-ti.patch
blob: 896149fb1e16e7e3ce71f30f696c1a6bbc5238a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 4d6c40ebfe10dd2fdc64bd7607e51275d5524e47 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date: Fri, 13 Sep 2019 17:23:26 +0100
Subject: [PATCH] staging: bcm2835-codec: Set default and error check
 timeperframe

G_PARM default was invalid as 0/0, and the driver didn't check
the value set in S_PARM wasn't 0/0.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
 .../vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c       | 7 +++++++
 1 file changed, 7 insertions(+)

--- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
+++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
@@ -1423,6 +1423,10 @@ static int vidioc_s_parm(struct file *fi
 	if (parm->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
 		return -EINVAL;
 
+	if (!parm->parm.output.timeperframe.denominator ||
+	    !parm->parm.output.timeperframe.numerator)
+		return -EINVAL;
+
 	ctx->framerate_num =
 			parm->parm.output.timeperframe.denominator;
 	ctx->framerate_denom =
@@ -2390,6 +2394,9 @@ static int bcm2835_codec_open(struct fil
 	ctx->colorspace = V4L2_COLORSPACE_REC709;
 	ctx->bitrate = 10 * 1000 * 1000;
 
+	ctx->framerate_num = 30;
+	ctx->framerate_denom = 1;
+
 	/* Initialise V4L2 contexts */
 	v4l2_fh_init(&ctx->fh, video_devdata(file));
 	file->private_data = &ctx->fh;