aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/mx2_camera.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/mx2_camera.c')
-rw-r--r--drivers/media/video/mx2_camera.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index e05e80090959..55d48442c2eb 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -973,11 +973,16 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
973 if (pix->bytesperline < 0) 973 if (pix->bytesperline < 0)
974 return pix->bytesperline; 974 return pix->bytesperline;
975 pix->sizeimage = pix->height * pix->bytesperline; 975 pix->sizeimage = pix->height * pix->bytesperline;
976 if (pix->sizeimage > (4 * 0x3ffff)) { /* CSIRXCNT limit */ 976 /* Check against the CSIRXCNT limit */
977 dev_warn(icd->dev.parent, 977 if (pix->sizeimage > 4 * 0x3ffff) {
978 "Image size (%u) above limit\n", 978 /* Adjust geometry, preserve aspect ratio */
979 pix->sizeimage); 979 unsigned int new_height = int_sqrt(4 * 0x3ffff *
980 return -EINVAL; 980 pix->height / pix->bytesperline);
981 pix->width = new_height * pix->width / pix->height;
982 pix->height = new_height;
983 pix->bytesperline = soc_mbus_bytes_per_line(pix->width,
984 xlate->host_fmt);
985 BUG_ON(pix->bytesperline < 0);
981 } 986 }
982 } 987 }
983 988