Commit e116077a authored by André Almeida's avatar André Almeida Committed by Greg Kroah-Hartman

media: vimc: cap: check v4l2_fill_pixfmt return value

[ Upstream commit 77ae46e1 ]

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: default avatarAndré Almeida <andrealmeid@collabora.com>
Suggested-by: default avatarHelen Koike <helen.koike@collabora.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent d0e10dee
...@@ -130,12 +130,15 @@ static int vimc_cap_s_fmt_vid_cap(struct file *file, void *priv, ...@@ -130,12 +130,15 @@ static int vimc_cap_s_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f) struct v4l2_format *f)
{ {
struct vimc_cap_device *vcap = video_drvdata(file); struct vimc_cap_device *vcap = video_drvdata(file);
int ret;
/* Do not change the format while stream is on */ /* Do not change the format while stream is on */
if (vb2_is_busy(&vcap->queue)) if (vb2_is_busy(&vcap->queue))
return -EBUSY; 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: " dev_dbg(vcap->dev, "%s: format update: "
"old:%dx%d (0x%x, %d, %d, %d, %d) " "old:%dx%d (0x%x, %d, %d, %d, %d) "
......
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