summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-04-08 08:37:09 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-04-08 08:37:30 +0200
commit7b8779541f86bbc6f6b461f1ea1c2f4310bb8335 (patch)
tree62fa9d8c51f91bcf6c1f9d96661aebd790bf1ff4
parent0530a2ea8f1f372d4e977f8bac3916259347cccd (diff)
downloadbarebox-7b8779541f86bbc6f6b461f1ea1c2f4310bb8335.tar.gz
fb: Fix use of unitialized variable
'ret' is only initialized when info->fbops->fb_activate_var exists, so only use it in this case. Reported-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/video/fb.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 2c8b8eb..ecf6142 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -85,8 +85,10 @@ static int fb_setup_mode(struct fb_info *info)
if (info->fbops->fb_activate_var) {
ret = info->fbops->fb_activate_var(info);
- if (ret)
+ if (ret) {
+ info->cdev.size = 0;
return ret;
+ }
}
if (!info->line_length)
@@ -94,14 +96,11 @@ static int fb_setup_mode(struct fb_info *info)
if (!info->screen_size)
info->screen_size = info->line_length * info->yres;
- if (!ret) {
- dev->resource[0].start = (resource_size_t)info->screen_base;
- info->cdev.size = info->line_length * info->yres;
- dev->resource[0].end = dev->resource[0].start + info->cdev.size - 1;
- } else
- info->cdev.size = 0;
+ dev->resource[0].start = (resource_size_t)info->screen_base;
+ info->cdev.size = info->line_length * info->yres;
+ dev->resource[0].end = dev->resource[0].start + info->cdev.size - 1;
- return ret;
+ return 0;
}
static int fb_set_modename(struct param_d *param, void *priv)