Skip to content

Commit

Permalink
AUO-K190x: make memory check in check_var more flexible
Browse files Browse the repository at this point in the history
Use only information from the new var to calculate the amount
of memory needed.

Signed-off-by: Heiko Stübner <heiko@sntech.de>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
  • Loading branch information
Heiko Stübner authored and Tomi Valkeinen committed Apr 4, 2013
1 parent 4e0ab85 commit 03fc149
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/video/auo_k190x.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ static void auok190xfb_imageblit(struct fb_info *info,
static int auok190xfb_check_var(struct fb_var_screeninfo *var,
struct fb_info *info)
{
struct device *dev = info->device;
int size;

if (info->var.xres != var->xres || info->var.yres != var->yres ||
info->var.xres_virtual != var->xres_virtual ||
info->var.yres_virtual != var->yres_virtual) {
Expand All @@ -388,9 +391,10 @@ static int auok190xfb_check_var(struct fb_var_screeninfo *var,
* Memory limit
*/

if ((info->fix.line_length * var->yres_virtual) > info->fix.smem_len) {
pr_info("%s: Memory Limit requested yres_virtual = %u\n",
__func__, var->yres_virtual);
size = var->xres_virtual * var->yres_virtual * var->bits_per_pixel / 8;
if (size > info->fix.smem_len) {
dev_err(dev, "Memory limit exceeded, requested %dK\n",
size >> 10);
return -ENOMEM;
}

Expand Down

0 comments on commit 03fc149

Please sign in to comment.