Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 261386
b: refs/heads/master
c: 28281a7
h: refs/heads/master
v: v3
  • Loading branch information
Guennadi Liakhovetski authored and Mauro Carvalho Chehab committed Jul 27, 2011
1 parent b05c93c commit 30b0e77
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 497833c6813dde5ca27cc94e28c973d601d601e1
refs/heads/master: 28281a71eb3bc08a0fb9514886e7d6e868f71b3f
15 changes: 10 additions & 5 deletions trunk/drivers/media/video/mx2_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -973,11 +973,16 @@ static int mx2_camera_try_fmt(struct soc_camera_device *icd,
if (pix->bytesperline < 0)
return pix->bytesperline;
pix->sizeimage = pix->height * pix->bytesperline;
if (pix->sizeimage > (4 * 0x3ffff)) { /* CSIRXCNT limit */
dev_warn(icd->dev.parent,
"Image size (%u) above limit\n",
pix->sizeimage);
return -EINVAL;
/* Check against the CSIRXCNT limit */
if (pix->sizeimage > 4 * 0x3ffff) {
/* Adjust geometry, preserve aspect ratio */
unsigned int new_height = int_sqrt(4 * 0x3ffff *
pix->height / pix->bytesperline);
pix->width = new_height * pix->width / pix->height;
pix->height = new_height;
pix->bytesperline = soc_mbus_bytes_per_line(pix->width,
xlate->host_fmt);
BUG_ON(pix->bytesperline < 0);
}
}

Expand Down

0 comments on commit 30b0e77

Please sign in to comment.