diff options
author | Andy Lutomirski <luto@MIT.EDU> | 2011-05-26 10:13:32 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-06-02 04:18:05 -0400 |
commit | da0241f12bf785f74e57ad6d67abdf269216f76b (patch) | |
tree | cf4a125e4f3ec5aac6b8d1e20a90750402903907 | |
parent | 3c004b4f7eab239e726c6dde0f6cfca46a96956b (diff) |
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>
-rw-r--r-- | drivers/video/efifb.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c index 7f06247a21e8..8cb31e106b9e 100644 --- a/drivers/video/efifb.c +++ b/drivers/video/efifb.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/pci.h> | 16 | #include <linux/pci.h> |
17 | #include <video/vga.h> | 17 | #include <video/vga.h> |
18 | 18 | ||
19 | static bool request_mem_succeeded = false; | ||
20 | |||
19 | static struct fb_var_screeninfo efifb_defined __devinitdata = { | 21 | static struct fb_var_screeninfo efifb_defined __devinitdata = { |
20 | .activate = FB_ACTIVATE_NOW, | 22 | .activate = FB_ACTIVATE_NOW, |
21 | .height = -1, | 23 | .height = -1, |
@@ -281,7 +283,9 @@ static void efifb_destroy(struct fb_info *info) | |||
281 | { | 283 | { |
282 | if (info->screen_base) | 284 | if (info->screen_base) |
283 | iounmap(info->screen_base); | 285 | iounmap(info->screen_base); |
284 | release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size); | 286 | if (request_mem_succeeded) |
287 | release_mem_region(info->apertures->ranges[0].base, | ||
288 | info->apertures->ranges[0].size); | ||
285 | framebuffer_release(info); | 289 | framebuffer_release(info); |
286 | } | 290 | } |
287 | 291 | ||
@@ -333,7 +337,6 @@ static int __devinit efifb_probe(struct platform_device *dev) | |||
333 | unsigned int size_vmode; | 337 | unsigned int size_vmode; |
334 | unsigned int size_remap; | 338 | unsigned int size_remap; |
335 | unsigned int size_total; | 339 | unsigned int size_total; |
336 | int request_succeeded = 0; | ||
337 | 340 | ||
338 | if (!screen_info.lfb_depth) | 341 | if (!screen_info.lfb_depth) |
339 | screen_info.lfb_depth = 32; | 342 | screen_info.lfb_depth = 32; |
@@ -387,7 +390,7 @@ static int __devinit efifb_probe(struct platform_device *dev) | |||
387 | efifb_fix.smem_len = size_remap; | 390 | efifb_fix.smem_len = size_remap; |
388 | 391 | ||
389 | if (request_mem_region(efifb_fix.smem_start, size_remap, "efifb")) { | 392 | if (request_mem_region(efifb_fix.smem_start, size_remap, "efifb")) { |
390 | request_succeeded = 1; | 393 | request_mem_succeeded = true; |
391 | } else { | 394 | } else { |
392 | /* We cannot make this fatal. Sometimes this comes from magic | 395 | /* We cannot make this fatal. Sometimes this comes from magic |
393 | spaces our resource handlers simply don't know about */ | 396 | spaces our resource handlers simply don't know about */ |
@@ -491,7 +494,7 @@ err_unmap: | |||
491 | err_release_fb: | 494 | err_release_fb: |
492 | framebuffer_release(info); | 495 | framebuffer_release(info); |
493 | err_release_mem: | 496 | err_release_mem: |
494 | if (request_succeeded) | 497 | if (request_mem_succeeded) |
495 | release_mem_region(efifb_fix.smem_start, size_total); | 498 | release_mem_region(efifb_fix.smem_start, size_total); |
496 | return err; | 499 | return err; |
497 | } | 500 | } |