lkml.org 
[lkml]   [2023]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v8 20/53] media: Remove duplicated index vs q->num_buffers check
Date
vb2_get_buffer() already checks if the requested index is valid.
Stop duplicating this kind of check everywhere.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
---
drivers/media/common/videobuf2/videobuf2-v4l2.c | 13 -------------
1 file changed, 13 deletions(-)

diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c
index 655133f1ae2b..9a4b11279fe7 100644
--- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
+++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
@@ -378,11 +378,6 @@ static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct media_device *md
return -EINVAL;
}

- if (b->index >= q->num_buffers) {
- dprintk(q, 1, "%s: buffer index out of range\n", opname);
- return -EINVAL;
- }
-
vb = vb2_get_buffer(q, b->index);
if (!vb) {
dprintk(q, 1, "%s: buffer %u is NULL\n", opname, b->index);
@@ -834,10 +829,6 @@ int vb2_qbuf(struct vb2_queue *q, struct media_device *mdev,
return -EBUSY;
}

- if (b->index >= q->num_buffers) {
- dprintk(q, 1, "buffer index out of range\n");
- return -EINVAL;
- }
vb = vb2_get_buffer(q, b->index);
if (!vb) {
dprintk(q, 1, "can't find the requested buffer %u\n", b->index);
@@ -909,10 +900,6 @@ int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb)
{
struct vb2_buffer *vb;

- if (eb->index >= q->num_buffers) {
- dprintk(q, 1, "buffer index out of range\n");
- return -EINVAL;
- }
vb = vb2_get_buffer(q, eb->index);
if (!vb) {
dprintk(q, 1, "can't find the requested buffer %u\n", eb->index);
--
2.39.2
\
 
 \ /
  Last update: 2023-09-27 18:52    [W:0.546 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site