summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2019-03-30 10:01:31 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-31 06:46:17 -0700
commit9fcfaab6142042675e210cf9781d30d20e689da1 (patch)
treebcff33b4d0780acbd40c0c46be23128f9e5dea21 /drivers/media
parente3a9d646ecf2c8d56910df300b66e9cfad213957 (diff)
downloadlinux-stable-9fcfaab6142042675e210cf9781d30d20e689da1.tar.gz
linux-stable-9fcfaab6142042675e210cf9781d30d20e689da1.tar.bz2
linux-stable-9fcfaab6142042675e210cf9781d30d20e689da1.zip
media: ov2659: make S_FMT succeed even if requested format doesn't match
[ Upstream commit bccb89cf9cd07a0690d519696a00c00a973b3fe4 ] This driver returns an error if unsupported media bus pixel code is requested by VIDIOC_SUBDEV_S_FMT. But according to Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst, Drivers must not return an error solely because the requested format doesn't match the device capabilities. They must instead modify the format to match what the hardware can provide. So select default format code and return success in that case. This is detected by v4l2-compliance. Cc: "Lad, Prabhakar" <prabhakar.csengg@gmail.com> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/i2c/ov2659.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
index 4715edc8ca33..e6a8b5669b9c 100644
--- a/drivers/media/i2c/ov2659.c
+++ b/drivers/media/i2c/ov2659.c
@@ -1117,8 +1117,10 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd,
if (ov2659_formats[index].code == mf->code)
break;
- if (index < 0)
- return -EINVAL;
+ if (index < 0) {
+ index = 0;
+ mf->code = ov2659_formats[index].code;
+ }
mf->colorspace = V4L2_COLORSPACE_SRGB;
mf->field = V4L2_FIELD_NONE;