diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2015-03-03 14:08:42 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-03 03:17:48 +0300 |
commit | ac0eb4809e88357b885c72b4e95def98235613c8 (patch) | |
tree | 19413a19af1d6ebd42e6c5cacadba9a22a8bb2c6 | |
parent | 9d9104fb9db90f7d806b1f0ba270c209b8d4fa25 (diff) | |
download | linux-ac0eb4809e88357b885c72b4e95def98235613c8.tar.xz |
[media] staging: media: omap4iss: video: Don't WARN() on unknown pixel formats
When mapping from a V4L2 pixel format to a media bus format in the
VIDIOC_TRY_FMT and VIDIOC_S_FMT handlers, the requested format may be
unsupported by the driver. Return a hardcoded default format instead of
WARN()ing in that case.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | drivers/staging/media/omap4iss/iss_video.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c index 69550445a341..e949b6f179aa 100644 --- a/drivers/staging/media/omap4iss/iss_video.c +++ b/drivers/staging/media/omap4iss/iss_video.c @@ -171,14 +171,14 @@ static void iss_video_pix_to_mbus(const struct v4l2_pix_format *pix, mbus->width = pix->width; mbus->height = pix->height; - for (i = 0; i < ARRAY_SIZE(formats); ++i) { + /* Skip the last format in the loop so that it will be selected if no + * match is found. + */ + for (i = 0; i < ARRAY_SIZE(formats) - 1; ++i) { if (formats[i].pixelformat == pix->pixelformat) break; } - if (WARN_ON(i == ARRAY_SIZE(formats))) - return; - mbus->code = formats[i].code; mbus->colorspace = pix->colorspace; mbus->field = pix->field; |