diff mbox

[6/9] video: One function call less in pvr2fb_common_init() after error detection

Message ID 54BD4FBD.3020308@users.sourceforge.net (mailing list archive)
State New, archived
Headers show

Commit Message

SF Markus Elfring Jan. 19, 2015, 6:41 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 19 Jan 2015 14:50:44 +0100

The iounmap() function could be called in two cases by the pvr2fb_common_init()
function during error handling even if the passed data structure element
contained still a null pointer.

This implementation detail could be improved by adjustments for jump labels.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/video/fbdev/pvr2fb.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/drivers/video/fbdev/pvr2fb.c b/drivers/video/fbdev/pvr2fb.c
index 7aa4ef1..9fb8bbf 100644
--- a/drivers/video/fbdev/pvr2fb.c
+++ b/drivers/video/fbdev/pvr2fb.c
@@ -773,14 +773,14 @@  static int pvr2fb_common_init(void)
 
 	if (!fb_info->screen_base) {
 		printk(KERN_ERR "pvr2fb: Failed to remap smem space\n");
-		goto out_err;
+		return -ENXIO;
 	}
 
 	par->mmio_base = (unsigned long)ioremap_nocache(pvr2_fix.mmio_start,
 							pvr2_fix.mmio_len);
 	if (!par->mmio_base) {
 		printk(KERN_ERR "pvr2fb: Failed to remap mmio space\n");
-		goto out_err;
+		goto io_unmap_screen;
 	}
 
 	fb_memset(fb_info->screen_base, 0, pvr2_fix.smem_len);
@@ -807,7 +807,7 @@  static int pvr2fb_common_init(void)
 	fb_alloc_cmap(&fb_info->cmap, 256, 0);
 
 	if (register_framebuffer(fb_info) < 0)
-		goto out_err;
+		goto io_unmap_mmio;
 	/*Must write PIXDEPTH to register before anything is displayed - so force init */
 	pvr2_init_display(fb_info);
 
@@ -840,10 +840,10 @@  static int pvr2fb_common_init(void)
 
 	return 0;
 
-out_err:
+io_unmap_mmio:
+	iounmap((void *)par->mmio_base);
+io_unmap_screen:
 	iounmap(fb_info->screen_base);
-	if (par->mmio_base)
-		iounmap((void *)par->mmio_base);
 
 	return -ENXIO;
 }