Commit 135afb2b authored by Sanjana Sanikommu's avatar Sanjana Sanikommu Committed by Greg Kroah-Hartman

staging: media: zoran: Modify return statement.

Challenge suggested by coccinelle.
Remove return variable and directly return the value
Issue found using ret.cocci
Signed-off-by: default avatarSanjana Sanikommu <sanjana99reddy99@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0d152523
...@@ -1739,7 +1739,6 @@ static int zoran_s_fmt_vid_overlay(struct file *file, void *__fh, ...@@ -1739,7 +1739,6 @@ static int zoran_s_fmt_vid_overlay(struct file *file, void *__fh,
struct v4l2_format *fmt) struct v4l2_format *fmt)
{ {
struct zoran_fh *fh = __fh; struct zoran_fh *fh = __fh;
int res;
dprintk(3, "x=%d, y=%d, w=%d, h=%d, cnt=%d, map=0x%p\n", dprintk(3, "x=%d, y=%d, w=%d, h=%d, cnt=%d, map=0x%p\n",
fmt->fmt.win.w.left, fmt->fmt.win.w.top, fmt->fmt.win.w.left, fmt->fmt.win.w.top,
...@@ -1747,11 +1746,10 @@ static int zoran_s_fmt_vid_overlay(struct file *file, void *__fh, ...@@ -1747,11 +1746,10 @@ static int zoran_s_fmt_vid_overlay(struct file *file, void *__fh,
fmt->fmt.win.w.height, fmt->fmt.win.w.height,
fmt->fmt.win.clipcount, fmt->fmt.win.clipcount,
fmt->fmt.win.bitmap); fmt->fmt.win.bitmap);
res = setup_window(fh, fmt->fmt.win.w.left, fmt->fmt.win.w.top, return setup_window(fh, fmt->fmt.win.w.left, fmt->fmt.win.w.top,
fmt->fmt.win.w.width, fmt->fmt.win.w.height, fmt->fmt.win.w.width, fmt->fmt.win.w.height,
(struct v4l2_clip __user *)fmt->fmt.win.clips, (struct v4l2_clip __user *)fmt->fmt.win.clips,
fmt->fmt.win.clipcount, fmt->fmt.win.bitmap); fmt->fmt.win.clipcount, fmt->fmt.win.bitmap);
return res;
} }
static int zoran_s_fmt_vid_out(struct file *file, void *__fh, static int zoran_s_fmt_vid_out(struct file *file, void *__fh,
...@@ -1773,8 +1771,7 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh, ...@@ -1773,8 +1771,7 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh,
if (fh->buffers.allocated) { if (fh->buffers.allocated) {
dprintk(1, KERN_ERR "%s: VIDIOC_S_FMT - cannot change capture mode\n", dprintk(1, KERN_ERR "%s: VIDIOC_S_FMT - cannot change capture mode\n",
ZR_DEVNAME(zr)); ZR_DEVNAME(zr));
res = -EBUSY; return -EBUSY;
return res;
} }
settings = fh->jpg_settings; settings = fh->jpg_settings;
...@@ -1859,8 +1856,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, ...@@ -1859,8 +1856,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh,
fh->buffers.active != ZORAN_FREE) { fh->buffers.active != ZORAN_FREE) {
dprintk(1, KERN_ERR "%s: VIDIOC_S_FMT - cannot change capture mode\n", dprintk(1, KERN_ERR "%s: VIDIOC_S_FMT - cannot change capture mode\n",
ZR_DEVNAME(zr)); ZR_DEVNAME(zr));
res = -EBUSY; return -EBUSY;
return res;
} }
if (fmt->fmt.pix.height > BUZ_MAX_HEIGHT) if (fmt->fmt.pix.height > BUZ_MAX_HEIGHT)
fmt->fmt.pix.height = BUZ_MAX_HEIGHT; fmt->fmt.pix.height = BUZ_MAX_HEIGHT;
...@@ -1910,7 +1906,7 @@ static int zoran_s_fbuf(struct file *file, void *__fh, ...@@ -1910,7 +1906,7 @@ static int zoran_s_fbuf(struct file *file, void *__fh,
{ {
struct zoran_fh *fh = __fh; struct zoran_fh *fh = __fh;
struct zoran *zr = fh->zr; struct zoran *zr = fh->zr;
int i, res = 0; int i;
__le32 printformat = __cpu_to_le32(fb->fmt.pixelformat); __le32 printformat = __cpu_to_le32(fb->fmt.pixelformat);
for (i = 0; i < NUM_FORMATS; i++) for (i = 0; i < NUM_FORMATS; i++)
...@@ -1923,20 +1919,15 @@ static int zoran_s_fbuf(struct file *file, void *__fh, ...@@ -1923,20 +1919,15 @@ static int zoran_s_fbuf(struct file *file, void *__fh,
return -EINVAL; return -EINVAL;
} }
res = setup_fbuffer(fh, fb->base, &zoran_formats[i], fb->fmt.width, return setup_fbuffer(fh, fb->base, &zoran_formats[i], fb->fmt.width,
fb->fmt.height, fb->fmt.bytesperline); fb->fmt.height, fb->fmt.bytesperline);
return res;
} }
static int zoran_overlay(struct file *file, void *__fh, unsigned int on) static int zoran_overlay(struct file *file, void *__fh, unsigned int on)
{ {
struct zoran_fh *fh = __fh; struct zoran_fh *fh = __fh;
int res;
res = setup_overlay(fh, on); return setup_overlay(fh, on);
return res;
} }
static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type type); static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type type);
...@@ -1963,8 +1954,7 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe ...@@ -1963,8 +1954,7 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe
KERN_ERR KERN_ERR
"%s: VIDIOC_REQBUFS - buffers already allocated\n", "%s: VIDIOC_REQBUFS - buffers already allocated\n",
ZR_DEVNAME(zr)); ZR_DEVNAME(zr));
res = -EBUSY; return -EBUSY;
return res;
} }
if (fh->map_mode == ZORAN_MAP_MODE_RAW && if (fh->map_mode == ZORAN_MAP_MODE_RAW &&
...@@ -1980,8 +1970,7 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe ...@@ -1980,8 +1970,7 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe
fh->buffers.num_buffers = req->count; fh->buffers.num_buffers = req->count;
if (v4l_fbuffer_alloc(fh)) { if (v4l_fbuffer_alloc(fh)) {
res = -ENOMEM; return -ENOMEM;
return res;
} }
} else if (fh->map_mode == ZORAN_MAP_MODE_JPG_REC || } else if (fh->map_mode == ZORAN_MAP_MODE_JPG_REC ||
fh->map_mode == ZORAN_MAP_MODE_JPG_PLAY) { fh->map_mode == ZORAN_MAP_MODE_JPG_PLAY) {
...@@ -1997,16 +1986,14 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe ...@@ -1997,16 +1986,14 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe
fh->buffers.buffer_size = zoran_v4l2_calc_bufsize(&fh->jpg_settings); fh->buffers.buffer_size = zoran_v4l2_calc_bufsize(&fh->jpg_settings);
if (jpg_fbuffer_alloc(fh)) { if (jpg_fbuffer_alloc(fh)) {
res = -ENOMEM; return -ENOMEM;
return res;
} }
} else { } else {
dprintk(1, dprintk(1,
KERN_ERR KERN_ERR
"%s: VIDIOC_REQBUFS - unknown type %d\n", "%s: VIDIOC_REQBUFS - unknown type %d\n",
ZR_DEVNAME(zr), req->type); ZR_DEVNAME(zr), req->type);
res = -EINVAL; return -EINVAL;
return res;
} }
return res; return res;
} }
...@@ -2014,11 +2001,8 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe ...@@ -2014,11 +2001,8 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe
static int zoran_querybuf(struct file *file, void *__fh, struct v4l2_buffer *buf) static int zoran_querybuf(struct file *file, void *__fh, struct v4l2_buffer *buf)
{ {
struct zoran_fh *fh = __fh; struct zoran_fh *fh = __fh;
int res;
res = zoran_v4l2_buffer_status(fh, buf, buf->index); return zoran_v4l2_buffer_status(fh, buf, buf->index);
return res;
} }
static int zoran_qbuf(struct file *file, void *__fh, struct v4l2_buffer *buf) static int zoran_qbuf(struct file *file, void *__fh, struct v4l2_buffer *buf)
...@@ -2033,8 +2017,7 @@ static int zoran_qbuf(struct file *file, void *__fh, struct v4l2_buffer *buf) ...@@ -2033,8 +2017,7 @@ static int zoran_qbuf(struct file *file, void *__fh, struct v4l2_buffer *buf)
dprintk(1, KERN_ERR dprintk(1, KERN_ERR
"%s: VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n", "%s: VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n",
ZR_DEVNAME(zr), buf->type, fh->map_mode); ZR_DEVNAME(zr), buf->type, fh->map_mode);
res = -EINVAL; return -EINVAL;
return res;
} }
res = zoran_v4l_queue_frame(fh, buf->index); res = zoran_v4l_queue_frame(fh, buf->index);
...@@ -2058,8 +2041,7 @@ static int zoran_qbuf(struct file *file, void *__fh, struct v4l2_buffer *buf) ...@@ -2058,8 +2041,7 @@ static int zoran_qbuf(struct file *file, void *__fh, struct v4l2_buffer *buf)
dprintk(1, KERN_ERR dprintk(1, KERN_ERR
"%s: VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n", "%s: VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n",
ZR_DEVNAME(zr), buf->type, fh->map_mode); ZR_DEVNAME(zr), buf->type, fh->map_mode);
res = -EINVAL; return -EINVAL;
return res;
} }
res = zoran_jpg_queue_frame(fh, buf->index, codec_mode); res = zoran_jpg_queue_frame(fh, buf->index, codec_mode);
...@@ -2093,15 +2075,13 @@ static int zoran_dqbuf(struct file *file, void *__fh, struct v4l2_buffer *buf) ...@@ -2093,15 +2075,13 @@ static int zoran_dqbuf(struct file *file, void *__fh, struct v4l2_buffer *buf)
dprintk(1, KERN_ERR dprintk(1, KERN_ERR
"%s: VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n", "%s: VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n",
ZR_DEVNAME(zr), buf->type, fh->map_mode); ZR_DEVNAME(zr), buf->type, fh->map_mode);
res = -EINVAL; return -EINVAL;
return res;
} }
num = zr->v4l_pend[zr->v4l_sync_tail & V4L_MASK_FRAME]; num = zr->v4l_pend[zr->v4l_sync_tail & V4L_MASK_FRAME];
if (file->f_flags & O_NONBLOCK && if (file->f_flags & O_NONBLOCK &&
zr->v4l_buffers.buffer[num].state != BUZ_STATE_DONE) { zr->v4l_buffers.buffer[num].state != BUZ_STATE_DONE) {
res = -EAGAIN; return -EAGAIN;
return res;
} }
res = v4l_sync(fh, num); res = v4l_sync(fh, num);
if (res) if (res)
...@@ -2124,16 +2104,14 @@ static int zoran_dqbuf(struct file *file, void *__fh, struct v4l2_buffer *buf) ...@@ -2124,16 +2104,14 @@ static int zoran_dqbuf(struct file *file, void *__fh, struct v4l2_buffer *buf)
dprintk(1, KERN_ERR dprintk(1, KERN_ERR
"%s: VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n", "%s: VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n",
ZR_DEVNAME(zr), buf->type, fh->map_mode); ZR_DEVNAME(zr), buf->type, fh->map_mode);
res = -EINVAL; return -EINVAL;
return res;
} }
num = zr->jpg_pend[zr->jpg_que_tail & BUZ_MASK_FRAME]; num = zr->jpg_pend[zr->jpg_que_tail & BUZ_MASK_FRAME];
if (file->f_flags & O_NONBLOCK && if (file->f_flags & O_NONBLOCK &&
zr->jpg_buffers.buffer[num].state != BUZ_STATE_DONE) { zr->jpg_buffers.buffer[num].state != BUZ_STATE_DONE) {
res = -EAGAIN; return -EAGAIN;
return res;
} }
bs.frame = 0; /* suppress compiler warning */ bs.frame = 0; /* suppress compiler warning */
res = jpg_sync(fh, &bs); res = jpg_sync(fh, &bs);
...@@ -2163,8 +2141,7 @@ static int zoran_streamon(struct file *file, void *__fh, enum v4l2_buf_type type ...@@ -2163,8 +2141,7 @@ static int zoran_streamon(struct file *file, void *__fh, enum v4l2_buf_type type
case ZORAN_MAP_MODE_RAW: /* raw capture */ case ZORAN_MAP_MODE_RAW: /* raw capture */
if (zr->v4l_buffers.active != ZORAN_ACTIVE || if (zr->v4l_buffers.active != ZORAN_ACTIVE ||
fh->buffers.active != ZORAN_ACTIVE) { fh->buffers.active != ZORAN_ACTIVE) {
res = -EBUSY; return -EBUSY;
return res;
} }
zr->v4l_buffers.active = fh->buffers.active = ZORAN_LOCKED; zr->v4l_buffers.active = fh->buffers.active = ZORAN_LOCKED;
...@@ -2182,8 +2159,7 @@ static int zoran_streamon(struct file *file, void *__fh, enum v4l2_buf_type type ...@@ -2182,8 +2159,7 @@ static int zoran_streamon(struct file *file, void *__fh, enum v4l2_buf_type type
/* what is the codec mode right now? */ /* what is the codec mode right now? */
if (zr->jpg_buffers.active != ZORAN_ACTIVE || if (zr->jpg_buffers.active != ZORAN_ACTIVE ||
fh->buffers.active != ZORAN_ACTIVE) { fh->buffers.active != ZORAN_ACTIVE) {
res = -EBUSY; return -EBUSY;
return res;
} }
zr->jpg_buffers.active = fh->buffers.active = ZORAN_LOCKED; zr->jpg_buffers.active = fh->buffers.active = ZORAN_LOCKED;
...@@ -2216,8 +2192,7 @@ static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type typ ...@@ -2216,8 +2192,7 @@ static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type typ
case ZORAN_MAP_MODE_RAW: /* raw capture */ case ZORAN_MAP_MODE_RAW: /* raw capture */
if (fh->buffers.active == ZORAN_FREE && if (fh->buffers.active == ZORAN_FREE &&
zr->v4l_buffers.active != ZORAN_FREE) { zr->v4l_buffers.active != ZORAN_FREE) {
res = -EPERM; /* stay off other's settings! */ return -EPERM; /* stay off other's settings! */
return res;
} }
if (zr->v4l_buffers.active == ZORAN_FREE) if (zr->v4l_buffers.active == ZORAN_FREE)
return res; return res;
...@@ -2247,8 +2222,7 @@ static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type typ ...@@ -2247,8 +2222,7 @@ static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type typ
case ZORAN_MAP_MODE_JPG_PLAY: case ZORAN_MAP_MODE_JPG_PLAY:
if (fh->buffers.active == ZORAN_FREE && if (fh->buffers.active == ZORAN_FREE &&
zr->jpg_buffers.active != ZORAN_FREE) { zr->jpg_buffers.active != ZORAN_FREE) {
res = -EPERM; /* stay off other's settings! */ return -EPERM; /* stay off other's settings! */
return res;
} }
if (zr->jpg_buffers.active == ZORAN_FREE) if (zr->jpg_buffers.active == ZORAN_FREE)
return res; return res;
...@@ -2288,8 +2262,7 @@ static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std) ...@@ -2288,8 +2262,7 @@ static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std)
if (res) if (res)
return res; return res;
res = wait_grab_pending(zr); return wait_grab_pending(zr);
return res;
} }
static int zoran_enum_input(struct file *file, void *__fh, static int zoran_enum_input(struct file *file, void *__fh,
...@@ -2332,8 +2305,7 @@ static int zoran_s_input(struct file *file, void *__fh, unsigned int input) ...@@ -2332,8 +2305,7 @@ static int zoran_s_input(struct file *file, void *__fh, unsigned int input)
return res; return res;
/* Make sure the changes come into effect */ /* Make sure the changes come into effect */
res = wait_grab_pending(zr); return wait_grab_pending(zr);
return res;
} }
static int zoran_enum_output(struct file *file, void *__fh, static int zoran_enum_output(struct file *file, void *__fh,
...@@ -2488,8 +2460,7 @@ static int zoran_s_jpegcomp(struct file *file, void *__fh, ...@@ -2488,8 +2460,7 @@ static int zoran_s_jpegcomp(struct file *file, void *__fh,
dprintk(1, KERN_WARNING dprintk(1, KERN_WARNING
"%s: VIDIOC_S_JPEGCOMP called while in playback/capture mode\n", "%s: VIDIOC_S_JPEGCOMP called while in playback/capture mode\n",
ZR_DEVNAME(zr)); ZR_DEVNAME(zr));
res = -EBUSY; return -EBUSY;
return res;
} }
res = zoran_check_jpg_settings(zr, &settings, 0); res = zoran_check_jpg_settings(zr, &settings, 0);
...@@ -2683,8 +2654,7 @@ zoran_mmap (struct file *file, ...@@ -2683,8 +2654,7 @@ zoran_mmap (struct file *file,
KERN_ERR KERN_ERR
"%s: %s(%s) - buffers not yet allocated\n", "%s: %s(%s) - buffers not yet allocated\n",
ZR_DEVNAME(zr), __func__, mode_name(fh->map_mode)); ZR_DEVNAME(zr), __func__, mode_name(fh->map_mode));
res = -ENOMEM; return -ENOMEM;
return res;
} }
first = offset / fh->buffers.buffer_size; first = offset / fh->buffers.buffer_size;
...@@ -2699,8 +2669,7 @@ zoran_mmap (struct file *file, ...@@ -2699,8 +2669,7 @@ zoran_mmap (struct file *file,
ZR_DEVNAME(zr), __func__, mode_name(fh->map_mode), offset, size, ZR_DEVNAME(zr), __func__, mode_name(fh->map_mode), offset, size,
fh->buffers.buffer_size, fh->buffers.buffer_size,
fh->buffers.num_buffers); fh->buffers.num_buffers);
res = -EINVAL; return -EINVAL;
return res;
} }
/* Check if any buffers are already mapped */ /* Check if any buffers are already mapped */
...@@ -2710,16 +2679,14 @@ zoran_mmap (struct file *file, ...@@ -2710,16 +2679,14 @@ zoran_mmap (struct file *file,
KERN_ERR KERN_ERR
"%s: %s(%s) - buffer %d already mapped\n", "%s: %s(%s) - buffer %d already mapped\n",
ZR_DEVNAME(zr), __func__, mode_name(fh->map_mode), i); ZR_DEVNAME(zr), __func__, mode_name(fh->map_mode), i);
res = -EBUSY; return -EBUSY;
return res;
} }
} }
/* map these buffers */ /* map these buffers */
map = kmalloc(sizeof(struct zoran_mapping), GFP_KERNEL); map = kmalloc(sizeof(struct zoran_mapping), GFP_KERNEL);
if (!map) { if (!map) {
res = -ENOMEM; return -ENOMEM;
return res;
} }
map->fh = fh; map->fh = fh;
atomic_set(&map->count, 1); atomic_set(&map->count, 1);
...@@ -2740,8 +2707,7 @@ zoran_mmap (struct file *file, ...@@ -2740,8 +2707,7 @@ zoran_mmap (struct file *file,
KERN_ERR KERN_ERR
"%s: %s(V4L) - remap_pfn_range failed\n", "%s: %s(V4L) - remap_pfn_range failed\n",
ZR_DEVNAME(zr), __func__); ZR_DEVNAME(zr), __func__);
res = -EAGAIN; return -EAGAIN;
return res;
} }
size -= todo; size -= todo;
start += todo; start += todo;
...@@ -2772,8 +2738,7 @@ zoran_mmap (struct file *file, ...@@ -2772,8 +2738,7 @@ zoran_mmap (struct file *file,
KERN_ERR KERN_ERR
"%s: %s(V4L) - remap_pfn_range failed\n", "%s: %s(V4L) - remap_pfn_range failed\n",
ZR_DEVNAME(zr), __func__); ZR_DEVNAME(zr), __func__);
res = -EAGAIN; return -EAGAIN;
return res;
} }
size -= todo; size -= todo;
start += todo; start += todo;
......
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