public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] omap3isp: video: Don't WARN() on unknown pixel formats
@ 2011-11-28 11:37 Laurent Pinchart
  2011-11-28 16:01 ` Sakari Ailus
  0 siblings, 1 reply; 8+ messages in thread
From: Laurent Pinchart @ 2011-11-28 11:37 UTC (permalink / raw)
  To: linux-media; +Cc: sakari.ailus

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>
---
 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 d100072..ffe7ce9 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,
 	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;
-- 
Regards,

Laurent Pinchart


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-12-07 18:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-28 11:37 [PATCH] omap3isp: video: Don't WARN() on unknown pixel formats Laurent Pinchart
2011-11-28 16:01 ` Sakari Ailus
2011-11-30  2:06   ` Laurent Pinchart
2011-11-30  8:35     ` Sakari Ailus
2011-11-30 23:26       ` Laurent Pinchart
2011-12-01 14:34         ` Sakari Ailus
2011-12-07 13:44           ` Laurent Pinchart
2011-12-07 18:19             ` Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox