linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Peter Senna Tschudin <peter.senna@gmail.com>
Cc: kernel-janitors@vger.kernel.org, Julia.Lawall@lip6.fr,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/14] drivers/media/v4l2-core/videobuf2-core.c: fix error return code
Date: Sat, 6 Oct 2012 08:17:42 -0300	[thread overview]
Message-ID: <20121006081742.48d5e5e8@infradead.org> (raw)
In-Reply-To: <1346945041-26676-10-git-send-email-peter.senna@gmail.com>

Em Thu,  6 Sep 2012 17:23:57 +0200
Peter Senna Tschudin <peter.senna@gmail.com> escreveu:

> From: Peter Senna Tschudin <peter.senna@gmail.com>
> 
> Convert a nonnegative error return code to a negative one, as returned
> elsewhere in the function.
> 
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> (
> if@p1 (\(ret < 0\|ret != 0\))
>  { ... return ret; }
> |
> ret@p1 = 0
> )
> ... when != ret = e1
>     when != &ret
> *if(...)
> {
>   ... when != ret = e2
>       when forall
>  return ret;
> }
> 
> // </smpl>
> 
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
> 
> ---
>  drivers/media/v4l2-core/videobuf2-core.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
> index 4da3df6..f6bc240 100644
> --- a/drivers/media/v4l2-core/videobuf2-core.c
> +++ b/drivers/media/v4l2-core/videobuf2-core.c
> @@ -1876,8 +1876,10 @@ static int __vb2_init_fileio(struct vb2_queue *q, int read)
>  	 */
>  	for (i = 0; i < q->num_buffers; i++) {
>  		fileio->bufs[i].vaddr = vb2_plane_vaddr(q->bufs[i], 0);
> -		if (fileio->bufs[i].vaddr == NULL)
> +		if (fileio->bufs[i].vaddr == NULL) {
> +			ret = -EFAULT;
>  			goto err_reqbufs;
> +		}

Had you test this patch? I suspect it breaks the driver, as there are failures under
streaming handling that are acceptable, as it may indicate that userspace was not
able to handle all queued frames in time. On such cases, what the Kernel does is to
just discard the frame. Userspace is able to detect it, by looking inside the timestamp
added on each frame.

>  		fileio->bufs[i].size = vb2_plane_size(q->bufs[i], 0);
>  	}
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html




Cheers,
Mauro

  reply	other threads:[~2012-10-06 11:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-06 15:23 [PATCH 4/14] drivers/media/v4l2-core/videobuf2-core.c: fix error return code Peter Senna Tschudin
2012-10-06 11:17 ` Mauro Carvalho Chehab [this message]
2012-10-10 16:47   ` Peter Senna Tschudin
2012-10-10 17:07     ` Sylwester Nawrocki
2012-10-18 14:47       ` [PATCH V2] " Peter Senna Tschudin
2012-10-18 15:28         ` Ezequiel Garcia
2012-10-18 15:39           ` Peter Senna Tschudin
2012-10-18 15:51           ` Sylwester Nawrocki

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=20121006081742.48d5e5e8@infradead.org \
    --to=mchehab@infradead.org \
    --cc=Julia.Lawall@lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=peter.senna@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).