Commit e9589567 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] janitor: vgastate: cleanup iounmap() usage

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.
parent 9f33cf76
...@@ -420,9 +420,8 @@ int save_vga(struct vgastate *state) ...@@ -420,9 +420,8 @@ int save_vga(struct vgastate *state)
if (!fbbase) { if (!fbbase) {
vga_cleanup(state); vga_cleanup(state);
iounmap(fbbase);
return 1; return 1;
} }
/* /*
* save only first 32K used by vgacon * save only first 32K used by vgacon
...@@ -430,10 +429,11 @@ int save_vga(struct vgastate *state) ...@@ -430,10 +429,11 @@ int save_vga(struct vgastate *state)
if (state->flags & VGA_SAVE_FONT0) { if (state->flags & VGA_SAVE_FONT0) {
saved->vga_font0 = vmalloc(4 * 8192); saved->vga_font0 = vmalloc(4 * 8192);
if (!saved->vga_font0) { if (!saved->vga_font0) {
vga_cleanup(state); iounmap(fbbase);
return 1; vga_cleanup(state);
return 1;
}
} }
}
/* /*
* largely unused, but if required by the caller * largely unused, but if required by the caller
* we'll just save everything. * we'll just save everything.
...@@ -441,19 +441,21 @@ int save_vga(struct vgastate *state) ...@@ -441,19 +441,21 @@ int save_vga(struct vgastate *state)
if (state->flags & VGA_SAVE_FONT1) { if (state->flags & VGA_SAVE_FONT1) {
saved->vga_font1 = vmalloc(state->memsize); saved->vga_font1 = vmalloc(state->memsize);
if (!saved->vga_font1) { if (!saved->vga_font1) {
vga_cleanup(state); iounmap(fbbase);
return 1; vga_cleanup(state);
return 1;
}
} }
}
/* /*
* Save 8K at plane0[0], and 8K at plane1[16K] * Save 8K at plane0[0], and 8K at plane1[16K]
*/ */
if (state->flags & VGA_SAVE_TEXT) { if (state->flags & VGA_SAVE_TEXT) {
saved->vga_text = vmalloc(8192 * 2); saved->vga_text = vmalloc(8192 * 2);
if (!saved->vga_text) { if (!saved->vga_text) {
vga_cleanup(state); iounmap(fbbase);
return 1; vga_cleanup(state);
} return 1;
}
} }
save_vga_text(state, fbbase); save_vga_text(state, fbbase);
...@@ -475,7 +477,6 @@ int restore_vga (struct vgastate *state) ...@@ -475,7 +477,6 @@ int restore_vga (struct vgastate *state)
if (!fbbase) { if (!fbbase) {
vga_cleanup(state); vga_cleanup(state);
iounmap(fbbase);
return 1; return 1;
} }
restore_vga_text(state, fbbase); restore_vga_text(state, fbbase);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment