提交 c3cd2574 编写于 作者: L Laurent Pinchart 提交者: Mauro Carvalho Chehab

[media] omap3isp: 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 format instead of
WARN()ing in that case.
Signed-off-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: NSakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 22db44cb
...@@ -210,14 +210,14 @@ static void isp_video_pix_to_mbus(const struct v4l2_pix_format *pix, ...@@ -210,14 +210,14 @@ static void isp_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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册