]> git.hungrycats.org Git - linux/commitdiff
[PATCH] janitor: vgastate: cleanup iounmap() usage
authorAndrew Morton <akpm@osdl.org>
Wed, 4 Feb 2004 02:47:00 +0000 (18:47 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Wed, 4 Feb 2004 02:47:00 +0000 (18:47 -0800)
From: "Randy.Dunlap" <rddunlap@osdl.org>

From: Leann Ogasawara <ogasawara@osdl.org>

Patch inserts missing iounmap's on error and also removes unnecessary
iounmap's.

drivers/video/vgastate.c

index ce3f315f8988a51c8ede155b2c2fcadbae29bc7d..190228189467c1106336ff34f9d999f4022d9dde 100644 (file)
@@ -420,9 +420,8 @@ int save_vga(struct vgastate *state)
 
                if (!fbbase) {
                        vga_cleanup(state);
-                       iounmap(fbbase);
                        return 1;
-       }
+               }
 
                /* 
                 * save only first 32K used by vgacon
@@ -430,10 +429,11 @@ int save_vga(struct vgastate *state)
                if (state->flags & VGA_SAVE_FONT0) {
                        saved->vga_font0 = vmalloc(4 * 8192);
                        if (!saved->vga_font0) {
-                       vga_cleanup(state);
-                       return 1;
+                               iounmap(fbbase);
+                               vga_cleanup(state);
+                               return 1;
+                       }
                }
-       }
                /* 
                 * largely unused, but if required by the caller
                 * we'll just save everything.
@@ -441,19 +441,21 @@ int save_vga(struct vgastate *state)
                if (state->flags & VGA_SAVE_FONT1) {
                        saved->vga_font1 = vmalloc(state->memsize);
                        if (!saved->vga_font1) {
-                       vga_cleanup(state);
-                       return 1;
+                               iounmap(fbbase);
+                               vga_cleanup(state);
+                               return 1;
+                       }
                }
-       }
                /*
                 * Save 8K at plane0[0], and 8K at plane1[16K]
                 */
                if (state->flags & VGA_SAVE_TEXT) {
                        saved->vga_text = vmalloc(8192 * 2);
                        if (!saved->vga_text) {
-                       vga_cleanup(state);
-                       return 1;
-               }
+                               iounmap(fbbase);
+                               vga_cleanup(state);
+                               return 1;
+                       }
                }
                
                save_vga_text(state, fbbase);
@@ -475,7 +477,6 @@ int restore_vga (struct vgastate *state)
 
                if (!fbbase) {
                        vga_cleanup(state);
-                       iounmap(fbbase);
                        return 1;
                }
                restore_vga_text(state, fbbase);