V4L/DVB (9911): em28xx: vidioc_try_fmt_vid_cap() doesn't need any lock
[firefly-linux-kernel-4.4.55.git] / drivers / media / video / em28xx / em28xx-video.c
index 2d88afefecf5728d12417ece416d802f5b02d0fe..1681af192b02b1d5c094ac5e6050fbe7f67856cc 100644 (file)
@@ -730,19 +730,17 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
        /* width must even because of the YUYV format
           height must be even because of interlacing */
        height &= 0xfffe;
-       width &= 0xfffe;
+       width  &= 0xfffe;
 
-       if (height < 32)
+       if (unlikely(height < 32))
                height = 32;
-       if (height > maxh)
+       if (unlikely(height > maxh))
                height = maxh;
-       if (width < 48)
+       if (unlikely(width < 48))
                width = 48;
-       if (width > maxw)
+       if (unlikely(width > maxw))
                width = maxw;
 
-       mutex_lock(&dev->lock);
-
        if (dev->board.is_em2800) {
                /* the em2800 can only scale down to 50% */
                if (height % (maxh / 2))
@@ -772,7 +770,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
        f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
        f->fmt.pix.field = V4L2_FIELD_INTERLACED;
 
-       mutex_unlock(&dev->lock);
        return 0;
 }