aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/v4l2-core
diff options
context:
space:
mode:
authorEzequiel Garcia <elezegarcia@gmail.com>2012-09-17 14:59:30 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-09-27 06:09:10 -0300
commit896f38f582730a19eb49677105b4fe4c0270b82e (patch)
tree70b769ece5f928d4b5e5cfe2f586f3882fb2acf2 /drivers/media/v4l2-core
parent[media] vivi: Add return code check at vb2_queue_init() (diff)
downloadlinux-dev-896f38f582730a19eb49677105b4fe4c0270b82e.tar.xz
linux-dev-896f38f582730a19eb49677105b4fe4c0270b82e.zip
[media] videobuf2-core: Replace BUG_ON and return an error at vb2_queue_init()
This replaces BUG_ON() calls with WARN_ON(), and returns EINVAL if some parameter is NULL, as suggested by Jonathan and Mauro. The BUG_ON() call is too drastic to be used in this case. See the full discussion here: http://www.spinics.net/lists/linux-media/msg52462.html Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r--drivers/media/v4l2-core/videobuf2-core.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index 59ed5223393b..e6a26b433e87 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -1738,14 +1738,17 @@ EXPORT_SYMBOL_GPL(vb2_poll);
*/
int vb2_queue_init(struct vb2_queue *q)
{
- BUG_ON(!q);
- BUG_ON(!q->ops);
- BUG_ON(!q->mem_ops);
- BUG_ON(!q->type);
- BUG_ON(!q->io_modes);
-
- BUG_ON(!q->ops->queue_setup);
- BUG_ON(!q->ops->buf_queue);
+ /*
+ * Sanity check
+ */
+ if (WARN_ON(!q) ||
+ WARN_ON(!q->ops) ||
+ WARN_ON(!q->mem_ops) ||
+ WARN_ON(!q->type) ||
+ WARN_ON(!q->io_modes) ||
+ WARN_ON(!q->ops->queue_setup) ||
+ WARN_ON(!q->ops->buf_queue))
+ return -EINVAL;
INIT_LIST_HEAD(&q->queued_list);
INIT_LIST_HEAD(&q->done_list);