AUO-K190x: make memory check in check_var more flexible
From: Heiko Stuebner <heiko@...> Date: Sun, 24 Jun 2012 17:11:35 +0200
Commit-Message
Patch-Comment
drivers/video/auo_k190x.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
Statistics
- 7 lines added
- 3 lines removed
Changes
-------------------------- drivers/video/auo_k190x.c ---------------------------
index 954b781..9cd9b7e 100644
@@ -375,6 +375,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) {
@@ -387,9 +390,10 @@ static int auok190xfb_check_var(struct fb_var_screeninfo *var,
* Memory limit
*/
+ 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;
}