9
0
Fork 0

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>
This commit is contained in:
Sascha Hauer 2014-04-08 08:37:09 +02:00
parent 0530a2ea8f
commit 7b8779541f
1 changed files with 7 additions and 8 deletions

View File

@ -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)