diff options
author | Stanislaw Gruszka <stf_xl@wp.pl> | 2008-10-16 07:03:43 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 20:21:44 +0200 |
commit | f928ac0a9810d46c8ba3bde7c969984340da9f5d (patch) | |
tree | 6a66e11156a9d75ae7240b3c1992c6406d448042 /drivers/video/atmel_lcdfb.c | |
parent | cirrusfb: do not change MCLK for Alpine chips (diff) | |
download | linux-f928ac0a9810d46c8ba3bde7c969984340da9f5d.tar.xz linux-f928ac0a9810d46c8ba3bde7c969984340da9f5d.zip |
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>
Diffstat (limited to 'drivers/video/atmel_lcdfb.c')
-rw-r--r-- | drivers/video/atmel_lcdfb.c | 7 |
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, var->transp.offset = var->transp.length = 0; var->xoffset = var->yoffset = 0; + if (info->fix.smem_len) { + unsigned int smem_len = (var->xres_virtual * var->yres_virtual + * ((var->bits_per_pixel + 7) / 8)); + if (smem_len > info->fix.smem_len) + return -EINVAL; + } + /* Saturate vertical and horizontal timings at maximum values */ var->vsync_len = min_t(u32, var->vsync_len, (ATMEL_LCDC_VPW >> ATMEL_LCDC_VPW_OFFSET) + 1); |