diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-11-28 06:25:30 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-20 06:37:09 -0500 |
commit | c3cd257402fdcd650816ec25b83480a24912430a (patch) | |
tree | 196dc0a3c236cdd7c61914926300d83ec00705d2 /drivers/media/video/omap3isp/ispvideo.c | |
parent | 22db44cb9cd67d56b02b2b5dceb10d3d1361b28b (diff) |
[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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/omap3isp/ispvideo.c')
-rw-r--r-- | drivers/media/video/omap3isp/ispvideo.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index d1000723c5ae..ffe7ce9eb4bc 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c | |||
@@ -210,14 +210,14 @@ static void isp_video_pix_to_mbus(const struct v4l2_pix_format *pix, | |||
210 | mbus->width = pix->width; | 210 | mbus->width = pix->width; |
211 | mbus->height = pix->height; | 211 | mbus->height = pix->height; |
212 | 212 | ||
213 | for (i = 0; i < ARRAY_SIZE(formats); ++i) { | 213 | /* Skip the last format in the loop so that it will be selected if no |
214 | * match is found. | ||
215 | */ | ||
216 | for (i = 0; i < ARRAY_SIZE(formats) - 1; ++i) { | ||
214 | if (formats[i].pixelformat == pix->pixelformat) | 217 | if (formats[i].pixelformat == pix->pixelformat) |
215 | break; | 218 | break; |
216 | } | 219 | } |
217 | 220 | ||
218 | if (WARN_ON(i == ARRAY_SIZE(formats))) | ||
219 | return; | ||
220 | |||
221 | mbus->code = formats[i].code; | 221 | mbus->code = formats[i].code; |
222 | mbus->colorspace = pix->colorspace; | 222 | mbus->colorspace = pix->colorspace; |
223 | mbus->field = pix->field; | 223 | mbus->field = pix->field; |