diff mbox

[09/20] mt9m111: cropcap check if type is CAPTURE

Message ID 1280501618-23634-10-git-send-email-m.grzeschik@pengutronix.de (mailing list archive)
State Superseded
Headers show

Commit Message

Michael Grzeschik July 30, 2010, 2:53 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c
index 3b19274..e8d8e9b 100644
--- a/drivers/media/video/mt9m111.c
+++ b/drivers/media/video/mt9m111.c
@@ -476,6 +476,9 @@  static int mt9m111_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
 
 static int mt9m111_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
 {
+	if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
+		return -EINVAL;
+
 	a->bounds.left			= MT9M111_MIN_DARK_COLS;
 	a->bounds.top			= MT9M111_MIN_DARK_ROWS;
 	a->bounds.width			= MT9M111_MAX_WIDTH;
@@ -484,7 +487,6 @@  static int mt9m111_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
 	a->defrect.top			= MT9M111_DEF_DARK_ROWS;
 	a->defrect.width		= MT9M111_DEF_WIDTH;
 	a->defrect.height		= MT9M111_DEF_HEIGHT;
-	a->type				= V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	a->pixelaspect.numerator	= 1;
 	a->pixelaspect.denominator	= 1;