summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-01-17 18:52:17 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-01-19 09:30:37 +0100
commit4fb2d9ce0a5adf38d08ecfd5913c21686c7529aa (patch)
tree6c209cdc9ac0cba159d5068b51fd860f5aa28b0f
parent76dd3e70a560fa69548f6b44ce933c78185b7dc4 (diff)
downloadbarebox-4fb2d9ce0a5adf38d08ecfd5913c21686c7529aa.tar.gz
fb: When setting a mode, also update xres, yres and fb size
Also, set size to 0 when setting up the framebuffer failed so that the user cannot write to uninitialized framebuffer memory. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/video/fb.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index ba34b9c..cf21c4b 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -77,12 +77,18 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param,
info->mode = &info->mode_list[mode];
- ret = info->fbops->fb_activate_var(info);
+ info->xres = info->mode->xres;
+ info->yres = info->mode->yres;
- dev->map_base = (unsigned long)info->screen_base;
+ ret = info->fbops->fb_activate_var(info);
- if (ret == 0)
+ if (!ret) {
+ dev->map_base = (unsigned long)info->screen_base;
+ info->cdev.size = info->xres * info->yres * (info->bits_per_pixel >> 3);
+ dev->size = info->cdev.size;
dev_param_set_generic(dev, param, val);
+ } else
+ info->cdev.size = 0;
return ret;
}