summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/media/platform/mxc/subdev/mx6s_capture.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/platform/mxc/subdev/mx6s_capture.c b/drivers/media/platform/mxc/subdev/mx6s_capture.c
index a5b2d3d2f0f2..ed60f8dc72dd 100644
--- a/drivers/media/platform/mxc/subdev/mx6s_capture.c
+++ b/drivers/media/platform/mxc/subdev/mx6s_capture.c
@@ -1425,6 +1425,12 @@ static int mx6s_vidioc_try_fmt_vid_cap(struct file *file, void *priv,
return -EINVAL;
}
+ if (f->fmt.pix.width == 0 || f->fmt.pix.height == 0) {
+ dev_err(csi_dev->dev, "width %d, height %d is too small.\n",
+ f->fmt.pix.width, f->fmt.pix.height);
+ return -EINVAL;
+ }
+
v4l2_fill_mbus_format(&mbus_fmt, pix, fmt->mbus_code);
ret = v4l2_subdev_call(sd, video, s_mbus_fmt, &mbus_fmt);
v4l2_fill_pix_format(pix, &mbus_fmt);