aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanislaw Gruszka <stf_xl@wp.pl>2008-10-16 01:03:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 14:21:44 -0400
commitf928ac0a9810d46c8ba3bde7c969984340da9f5d (patch)
tree6a66e11156a9d75ae7240b3c1992c6406d448042
parent486ff387c0f27030a3cfb142469ba140f2d8976e (diff)
atmel_lcdfb: disallow setting larger resolution than the framebuffer memory can handle
Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Krzysztof Helt <krzysztof.h1@wp.pl> Cc: Haavard Skinnemoen <hskinnemoen@atmel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/video/atmel_lcdfb.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index d38fd5217422..f8d0a57a07cb 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -372,6 +372,13 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
372 var->transp.offset = var->transp.length = 0; 372 var->transp.offset = var->transp.length = 0;
373 var->xoffset = var->yoffset = 0; 373 var->xoffset = var->yoffset = 0;
374 374
375 if (info->fix.smem_len) {
376 unsigned int smem_len = (var->xres_virtual * var->yres_virtual
377 * ((var->bits_per_pixel + 7) / 8));
378 if (smem_len > info->fix.smem_len)
379 return -EINVAL;
380 }
381
375 /* Saturate vertical and horizontal timings at maximum values */ 382 /* Saturate vertical and horizontal timings at maximum values */
376 var->vsync_len = min_t(u32, var->vsync_len, 383 var->vsync_len = min_t(u32, var->vsync_len,
377 (ATMEL_LCDC_VPW >> ATMEL_LCDC_VPW_OFFSET) + 1); 384 (ATMEL_LCDC_VPW >> ATMEL_LCDC_VPW_OFFSET) + 1);