Commit afa5d19a authored by Thaissa Falbo's avatar Thaissa Falbo Committed by Greg Kroah-Hartman

staging: media: davinci_vpfe: remove unnecessary ret variable

Simplified return of funcions by removing assignment of ret variable.

Coccinelle script used:

@@
local idexpression ret;
expression e;
@@

- ret = e;
- if(ret)
-       return ret;
+ if(e)
+       return e;

@@
local idexpression ret;
expression e;
@@

- ret = e;
- return ret;
+ return e;

@@
local idexpression ret;
expression e;
@@

- ret = e;
- if(ret){
+ if(e){
        ... when != ret
-       return ret;
+       return e;
}

@@
type T; identifier i;
@@
- T i;
... when != i
Signed-off-by: default avatarThaissa Falbo <thaissa.falbo@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8e8919fe
...@@ -172,11 +172,9 @@ static int vpfe_prepare_pipeline(struct vpfe_video_device *video) ...@@ -172,11 +172,9 @@ static int vpfe_prepare_pipeline(struct vpfe_video_device *video)
static int vpfe_update_pipe_state(struct vpfe_video_device *video) static int vpfe_update_pipe_state(struct vpfe_video_device *video)
{ {
struct vpfe_pipeline *pipe = &video->pipe; struct vpfe_pipeline *pipe = &video->pipe;
int ret;
ret = vpfe_prepare_pipeline(video); if (vpfe_prepare_pipeline(video))
if (ret) return vpfe_prepare_pipeline(video);
return ret;
/* /*
* Find out if there is any input video * Find out if there is any input video
...@@ -184,10 +182,9 @@ static int vpfe_update_pipe_state(struct vpfe_video_device *video) ...@@ -184,10 +182,9 @@ static int vpfe_update_pipe_state(struct vpfe_video_device *video)
*/ */
if (pipe->input_num == 0) { if (pipe->input_num == 0) {
pipe->state = VPFE_PIPELINE_STREAM_CONTINUOUS; pipe->state = VPFE_PIPELINE_STREAM_CONTINUOUS;
ret = vpfe_update_current_ext_subdev(video); if (vpfe_update_current_ext_subdev(video)) {
if (ret) {
pr_err("Invalid external subdev\n"); pr_err("Invalid external subdev\n");
return ret; return vpfe_update_current_ext_subdev(video);
} }
} else { } else {
pipe->state = VPFE_PIPELINE_STREAM_SINGLESHOT; pipe->state = VPFE_PIPELINE_STREAM_SINGLESHOT;
...@@ -670,7 +667,6 @@ static int vpfe_enum_fmt(struct file *file, void *priv, ...@@ -670,7 +667,6 @@ static int vpfe_enum_fmt(struct file *file, void *priv,
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
struct v4l2_format format; struct v4l2_format format;
struct media_pad *remote; struct media_pad *remote;
int ret;
v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_enum_fmt\n"); v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_enum_fmt\n");
...@@ -699,11 +695,10 @@ static int vpfe_enum_fmt(struct file *file, void *priv, ...@@ -699,11 +695,10 @@ static int vpfe_enum_fmt(struct file *file, void *priv,
sd_fmt.pad = remote->index; sd_fmt.pad = remote->index;
sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE; sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
/* get output format of remote subdev */ /* get output format of remote subdev */
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &sd_fmt); if (v4l2_subdev_call(subdev, pad, get_fmt, NULL, &sd_fmt)) {
if (ret) {
v4l2_err(&vpfe_dev->v4l2_dev, v4l2_err(&vpfe_dev->v4l2_dev,
"invalid remote subdev for video node\n"); "invalid remote subdev for video node\n");
return ret; return v4l2_subdev_call(subdev, pad, get_fmt, NULL, &sd_fmt);
} }
/* convert to pix format */ /* convert to pix format */
mbus.code = sd_fmt.format.code; mbus.code = sd_fmt.format.code;
...@@ -730,7 +725,6 @@ static int vpfe_s_fmt(struct file *file, void *priv, ...@@ -730,7 +725,6 @@ static int vpfe_s_fmt(struct file *file, void *priv,
struct vpfe_video_device *video = video_drvdata(file); struct vpfe_video_device *video = video_drvdata(file);
struct vpfe_device *vpfe_dev = video->vpfe_dev; struct vpfe_device *vpfe_dev = video->vpfe_dev;
struct v4l2_format format; struct v4l2_format format;
int ret;
v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_s_fmt\n"); v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_s_fmt\n");
/* If streaming is started, return error */ /* If streaming is started, return error */
...@@ -739,9 +733,8 @@ static int vpfe_s_fmt(struct file *file, void *priv, ...@@ -739,9 +733,8 @@ static int vpfe_s_fmt(struct file *file, void *priv,
return -EBUSY; return -EBUSY;
} }
/* get adjacent subdev's output pad format */ /* get adjacent subdev's output pad format */
ret = __vpfe_video_get_format(video, &format); if (__vpfe_video_get_format(video, &format))
if (ret) return __vpfe_video_get_format(video, &format);
return ret;
*fmt = format; *fmt = format;
video->fmt = *fmt; video->fmt = *fmt;
return 0; return 0;
...@@ -764,13 +757,11 @@ static int vpfe_try_fmt(struct file *file, void *priv, ...@@ -764,13 +757,11 @@ static int vpfe_try_fmt(struct file *file, void *priv,
struct vpfe_video_device *video = video_drvdata(file); struct vpfe_video_device *video = video_drvdata(file);
struct vpfe_device *vpfe_dev = video->vpfe_dev; struct vpfe_device *vpfe_dev = video->vpfe_dev;
struct v4l2_format format; struct v4l2_format format;
int ret;
v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_try_fmt\n"); v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_try_fmt\n");
/* get adjacent subdev's output pad format */ /* get adjacent subdev's output pad format */
ret = __vpfe_video_get_format(video, &format); if (__vpfe_video_get_format(video, &format))
if (ret) return __vpfe_video_get_format(video, &format);
return ret;
*fmt = format; *fmt = format;
return 0; return 0;
...@@ -847,9 +838,8 @@ static int vpfe_s_input(struct file *file, void *priv, unsigned int index) ...@@ -847,9 +838,8 @@ static int vpfe_s_input(struct file *file, void *priv, unsigned int index)
v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_s_input\n"); v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_s_input\n");
ret = mutex_lock_interruptible(&video->lock); if (mutex_lock_interruptible(&video->lock))
if (ret) return mutex_lock_interruptible(&video->lock);
return ret;
/* /*
* If streaming is started return device busy * If streaming is started return device busy
* error * error
...@@ -950,9 +940,8 @@ static int vpfe_s_std(struct file *file, void *priv, v4l2_std_id std_id) ...@@ -950,9 +940,8 @@ static int vpfe_s_std(struct file *file, void *priv, v4l2_std_id std_id)
v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_s_std\n"); v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_s_std\n");
/* Call decoder driver function to set the standard */ /* Call decoder driver function to set the standard */
ret = mutex_lock_interruptible(&video->lock); if (mutex_lock_interruptible(&video->lock))
if (ret) return mutex_lock_interruptible(&video->lock);
return ret;
sdinfo = video->current_ext_subdev; sdinfo = video->current_ext_subdev;
/* If streaming is started, return device busy error */ /* If streaming is started, return device busy error */
if (video->started) { if (video->started) {
...@@ -1338,9 +1327,8 @@ static int vpfe_reqbufs(struct file *file, void *priv, ...@@ -1338,9 +1327,8 @@ static int vpfe_reqbufs(struct file *file, void *priv,
return -EINVAL; return -EINVAL;
} }
ret = mutex_lock_interruptible(&video->lock); if (mutex_lock_interruptible(&video->lock))
if (ret) return mutex_lock_interruptible(&video->lock);
return ret;
if (video->io_usrs != 0) { if (video->io_usrs != 0) {
v4l2_err(&vpfe_dev->v4l2_dev, "Only one IO user allowed\n"); v4l2_err(&vpfe_dev->v4l2_dev, "Only one IO user allowed\n");
...@@ -1366,11 +1354,10 @@ static int vpfe_reqbufs(struct file *file, void *priv, ...@@ -1366,11 +1354,10 @@ static int vpfe_reqbufs(struct file *file, void *priv,
q->buf_struct_size = sizeof(struct vpfe_cap_buffer); q->buf_struct_size = sizeof(struct vpfe_cap_buffer);
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
ret = vb2_queue_init(q); if (vb2_queue_init(q)) {
if (ret) {
v4l2_err(&vpfe_dev->v4l2_dev, "vb2_queue_init() failed\n"); v4l2_err(&vpfe_dev->v4l2_dev, "vb2_queue_init() failed\n");
vb2_dma_contig_cleanup_ctx(vpfe_dev->pdev); vb2_dma_contig_cleanup_ctx(vpfe_dev->pdev);
return ret; return vb2_queue_init(q);
} }
fh->io_allowed = 1; fh->io_allowed = 1;
...@@ -1546,9 +1533,8 @@ static int vpfe_streamoff(struct file *file, void *priv, ...@@ -1546,9 +1533,8 @@ static int vpfe_streamoff(struct file *file, void *priv,
return -EINVAL; return -EINVAL;
} }
ret = mutex_lock_interruptible(&video->lock); if (mutex_lock_interruptible(&video->lock))
if (ret) return mutex_lock_interruptible(&video->lock);
return ret;
vpfe_stop_capture(video); vpfe_stop_capture(video);
ret = vb2_streamoff(&video->buffer_queue, buf_type); ret = vb2_streamoff(&video->buffer_queue, buf_type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment