lkml.org 
[lkml]   [2016]   [Dec]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 5/8] [media] videobuf-dma-sg: Move two assignments for error codes in __videobuf_mmap_mapper()
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 26 Dec 2016 20:48:50 +0100

Move two assignments for the local variable "retval" so that these statements
will only be executed if a previous action failed in this function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/media/v4l2-core/videobuf-dma-sg.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c
index 9ccdc11aa016..d09ddf2e56fe 100644
--- a/drivers/media/v4l2-core/videobuf-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
@@ -596,8 +596,6 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
unsigned int first, last, size = 0, i;
int retval;

- retval = -EINVAL;
-
BUG_ON(!mem);
MAGIC_CHECK(mem->magic, MAGIC_SG_MEM);

@@ -613,16 +611,18 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
if (!size) {
dprintk(1, "mmap app bug: offset invalid [offset=0x%lx]\n",
(vma->vm_pgoff << PAGE_SHIFT));
+ retval = -EINVAL;
goto done;
}

last = first;

/* create mapping + update buffer list */
- retval = -ENOMEM;
map = kmalloc(sizeof(struct videobuf_mapping), GFP_KERNEL);
- if (!map)
+ if (!map) {
+ retval = -ENOMEM;
goto done;
+ }

size = 0;
for (i = first; i <= last; i++) {
--
2.11.0
\
 
 \ /
  Last update: 2016-12-26 21:51    [W:0.109 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site