media: vimc: cap: check v4l2_fill_pixfmt return value
authorAndré Almeida <andrealmeid@collabora.com>
Mon, 17 Jun 2019 16:28:02 +0000 (12:28 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 24 Jun 2019 18:58:40 +0000 (14:58 -0400)
v4l2_fill_pixfmt() returns -EINVAL if the pixelformat used as parameter is
invalid or if the user is trying to use a multiplanar format with the
singleplanar API. Currently, the vimc_cap_try_fmt_vid_cap() returns such
value, but vimc_cap_s_fmt_vid_cap() is ignoring it. Fix that and returns
an error value if vimc_cap_try_fmt_vid_cap() has failed.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
Suggested-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/vimc/vimc-capture.c

index 946dc0908566be82a4c17d5a39768365758ea809..664855708fdfca6d5bdd81af1bff93ab2bd22488 100644 (file)
@@ -142,12 +142,15 @@ static int vimc_cap_s_fmt_vid_cap(struct file *file, void *priv,
                                  struct v4l2_format *f)
 {
        struct vimc_cap_device *vcap = video_drvdata(file);
+       int ret;
 
        /* Do not change the format while stream is on */
        if (vb2_is_busy(&vcap->queue))
                return -EBUSY;
 
-       vimc_cap_try_fmt_vid_cap(file, priv, f);
+       ret = vimc_cap_try_fmt_vid_cap(file, priv, f);
+       if (ret)
+               return ret;
 
        dev_dbg(vcap->dev, "%s: format update: "
                "old:%dx%d (0x%x, %d, %d, %d, %d) "