summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2014-05-09 12:32:10 -0300
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-05-23 13:59:02 -0300
commit4cf743de880e3e60f106b7fc713f235abad9ea7e (patch)
tree3db9500bd2a3cbd85ffa8f33c7d7aa16e2a9f51a
parentb646f0b7290c2cb68450c61256eb475e44437026 (diff)
[media] vb2: fix num_buffers calculation if req->count > VIDEO_MAX_FRAMES
num_buffers can't be bigger than VIDEO_MAX_FRAME. This is assured by: num_buffers = min_t(unsigned int, req->count, VIDEO_MAX_FRAME); However, this value is overriden by: num_buffers = max_t(unsigned int, req->count, q->min_buffers_needed); It should, instead, use the previously calculated value as an input to max_t: num_buffers = max_t(unsigned int, num_buffers, q->min_buffers_needed); Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/v4l2-core/videobuf2-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index 8d37e291f722..6489c991700a 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -905,7 +905,7 @@ static int __reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
* Make sure the requested values and current defaults are sane.
*/
num_buffers = min_t(unsigned int, req->count, VIDEO_MAX_FRAME);
- num_buffers = max_t(unsigned int, req->count, q->min_buffers_needed);
+ num_buffers = max_t(unsigned int, num_buffers, q->min_buffers_needed);
memset(q->plane_sizes, 0, sizeof(q->plane_sizes));
memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx));
q->memory = req->memory;