Commit ac0eb480 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 9d9104fb
...@@ -171,14 +171,14 @@ static void iss_video_pix_to_mbus(const struct v4l2_pix_format *pix, ...@@ -171,14 +171,14 @@ static void iss_video_pix_to_mbus(const struct v4l2_pix_format *pix,
mbus->width = pix->width; mbus->width = pix->width;
mbus->height = pix->height; 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) if (formats[i].pixelformat == pix->pixelformat)
break; break;
} }
if (WARN_ON(i == ARRAY_SIZE(formats)))
return;
mbus->code = formats[i].code; mbus->code = formats[i].code;
mbus->colorspace = pix->colorspace; mbus->colorspace = pix->colorspace;
mbus->field = pix->field; mbus->field = pix->field;
......
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