Skip to content

Commit

Permalink
[media] omap3isp: video: Don't WARN() on unknown pixel formats
Browse files Browse the repository at this point in the history
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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Laurent Pinchart authored and Mauro Carvalho Chehab committed Dec 20, 2011
1 parent 22db44c commit c3cd257
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/media/video/omap3isp/ispvideo.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,14 @@ static void isp_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;
Expand Down

0 comments on commit c3cd257

Please sign in to comment.