efifb: Fix mismatched request/release_mem_region
Signed-off-by: Andy Lutomirski <luto@mit.edu> Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
3c004b4f7e
commit
da0241f12b
|
@ -16,6 +16,8 @@
|
||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
#include <video/vga.h>
|
#include <video/vga.h>
|
||||||
|
|
||||||
|
static bool request_mem_succeeded = false;
|
||||||
|
|
||||||
static struct fb_var_screeninfo efifb_defined __devinitdata = {
|
static struct fb_var_screeninfo efifb_defined __devinitdata = {
|
||||||
.activate = FB_ACTIVATE_NOW,
|
.activate = FB_ACTIVATE_NOW,
|
||||||
.height = -1,
|
.height = -1,
|
||||||
|
@ -281,7 +283,9 @@ static void efifb_destroy(struct fb_info *info)
|
||||||
{
|
{
|
||||||
if (info->screen_base)
|
if (info->screen_base)
|
||||||
iounmap(info->screen_base);
|
iounmap(info->screen_base);
|
||||||
release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size);
|
if (request_mem_succeeded)
|
||||||
|
release_mem_region(info->apertures->ranges[0].base,
|
||||||
|
info->apertures->ranges[0].size);
|
||||||
framebuffer_release(info);
|
framebuffer_release(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +337,6 @@ static int __devinit efifb_probe(struct platform_device *dev)
|
||||||
unsigned int size_vmode;
|
unsigned int size_vmode;
|
||||||
unsigned int size_remap;
|
unsigned int size_remap;
|
||||||
unsigned int size_total;
|
unsigned int size_total;
|
||||||
int request_succeeded = 0;
|
|
||||||
|
|
||||||
if (!screen_info.lfb_depth)
|
if (!screen_info.lfb_depth)
|
||||||
screen_info.lfb_depth = 32;
|
screen_info.lfb_depth = 32;
|
||||||
|
@ -387,7 +390,7 @@ static int __devinit efifb_probe(struct platform_device *dev)
|
||||||
efifb_fix.smem_len = size_remap;
|
efifb_fix.smem_len = size_remap;
|
||||||
|
|
||||||
if (request_mem_region(efifb_fix.smem_start, size_remap, "efifb")) {
|
if (request_mem_region(efifb_fix.smem_start, size_remap, "efifb")) {
|
||||||
request_succeeded = 1;
|
request_mem_succeeded = true;
|
||||||
} else {
|
} else {
|
||||||
/* We cannot make this fatal. Sometimes this comes from magic
|
/* We cannot make this fatal. Sometimes this comes from magic
|
||||||
spaces our resource handlers simply don't know about */
|
spaces our resource handlers simply don't know about */
|
||||||
|
@ -491,7 +494,7 @@ err_unmap:
|
||||||
err_release_fb:
|
err_release_fb:
|
||||||
framebuffer_release(info);
|
framebuffer_release(info);
|
||||||
err_release_mem:
|
err_release_mem:
|
||||||
if (request_succeeded)
|
if (request_mem_succeeded)
|
||||||
release_mem_region(efifb_fix.smem_start, size_total);
|
release_mem_region(efifb_fix.smem_start, size_total);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue