All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ezequiel Garcia <elezegarcia@gmail.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH v2] uvc: Add return code check at vb2_queue_init()
Date: Wed, 26 Sep 2012 13:48:10 +0200	[thread overview]
Message-ID: <2093441.dEigvJOvHo@avalon> (raw)
In-Reply-To: <1348659034-10880-1-git-send-email-elezegarcia@gmail.com>

On Wednesday 26 September 2012 08:30:34 Ezequiel Garcia wrote:
> This function returns an integer and it's mandatory
> to check the return code.
> 
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Applied to my tree, thank you.

> ---
> Changes from v1:
>  * Change variable name rc -> ret
>  * Add return 0 on successful uvc_queue_init
> 
>  drivers/media/usb/uvc/uvc_queue.c |   10 ++++++++--
>  drivers/media/usb/uvc/uvc_video.c |    4 +++-
>  drivers/media/usb/uvc/uvcvideo.h  |    2 +-
>  3 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_queue.c
> b/drivers/media/usb/uvc/uvc_queue.c index 5577381..18a91fa 100644
> --- a/drivers/media/usb/uvc/uvc_queue.c
> +++ b/drivers/media/usb/uvc/uvc_queue.c
> @@ -122,21 +122,27 @@ static struct vb2_ops uvc_queue_qops = {
>  	.buf_finish = uvc_buffer_finish,
>  };
> 
> -void uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type,
> +int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type,
> int drop_corrupted)
>  {
> +	int ret;
> +
>  	queue->queue.type = type;
>  	queue->queue.io_modes = VB2_MMAP | VB2_USERPTR;
>  	queue->queue.drv_priv = queue;
>  	queue->queue.buf_struct_size = sizeof(struct uvc_buffer);
>  	queue->queue.ops = &uvc_queue_qops;
>  	queue->queue.mem_ops = &vb2_vmalloc_memops;
> -	vb2_queue_init(&queue->queue);
> +	ret = vb2_queue_init(&queue->queue);
> +	if (ret)
> +		return ret;
> 
>  	mutex_init(&queue->mutex);
>  	spin_lock_init(&queue->irqlock);
>  	INIT_LIST_HEAD(&queue->irqqueue);
>  	queue->flags = drop_corrupted ? UVC_QUEUE_DROP_CORRUPTED : 0;
> +
> +	return 0;
>  }
> 
>  /*
> ---------------------------------------------------------------------------
> -- diff --git a/drivers/media/usb/uvc/uvc_video.c
> b/drivers/media/usb/uvc/uvc_video.c index 1c15b42..57c3076 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -1755,7 +1755,9 @@ int uvc_video_init(struct uvc_streaming *stream)
>  	atomic_set(&stream->active, 0);
> 
>  	/* Initialize the video buffers queue. */
> -	uvc_queue_init(&stream->queue, stream->type, !uvc_no_drop_param);
> +	ret = uvc_queue_init(&stream->queue, stream->type, !uvc_no_drop_param);
> +	if (ret)
> +		return ret;
> 
>  	/* Alternate setting 0 should be the default, yet the XBox Live Vision
>  	 * Cam (and possibly other devices) crash or otherwise misbehave if
> diff --git a/drivers/media/usb/uvc/uvcvideo.h
> b/drivers/media/usb/uvc/uvcvideo.h index 3764040..af216ec 100644
> --- a/drivers/media/usb/uvc/uvcvideo.h
> +++ b/drivers/media/usb/uvc/uvcvideo.h
> @@ -600,7 +600,7 @@ extern struct uvc_driver uvc_driver;
>  extern struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id);
> 
>  /* Video buffers queue management. */
> -extern void uvc_queue_init(struct uvc_video_queue *queue,
> +extern int uvc_queue_init(struct uvc_video_queue *queue,
>  		enum v4l2_buf_type type, int drop_corrupted);
>  extern int uvc_alloc_buffers(struct uvc_video_queue *queue,
>  		struct v4l2_requestbuffers *rb);
-- 
Regards,

Laurent Pinchart


      reply	other threads:[~2012-09-26 11:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-26 11:30 [PATCH v2] uvc: Add return code check at vb2_queue_init() Ezequiel Garcia
2012-09-26 11:48 ` Laurent Pinchart [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2093441.dEigvJOvHo@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=elezegarcia@gmail.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.