linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/14] drivers/media/v4l2-core/videobuf2-core.c: fix error return code
@ 2012-09-06 15:23 Peter Senna Tschudin
  2012-10-06 11:17 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Senna Tschudin @ 2012-09-06 15:23 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: kernel-janitors, Julia.Lawall, linux-media, linux-kernel

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;
+		}
 		fileio->bufs[i].size = vb2_plane_size(q->bufs[i], 0);
 	}
 


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-10-18 15:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).