Skip to content

Commit

Permalink
cirrusfb: fix error paths in cirrusfb_xxx_register()
Browse files Browse the repository at this point in the history
Balance iomap and iounmap and alloc and free calls in case of error druing
device register (probing).

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Krzysztof Helt authored and Linus Torvalds committed Apr 1, 2009
1 parent 9e84806 commit bc5d8ac
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions drivers/video/cirrusfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2090,8 +2090,6 @@ static int __devinit cirrusfb_register(struct fb_info *info)

err_dealloc_cmap:
fb_dealloc_cmap(&info->cmap);
cinfo->unmap(info);
framebuffer_release(info);
return err;
}

Expand Down Expand Up @@ -2328,18 +2326,15 @@ static int __devinit cirrusfb_zorro_register(struct zorro_dev *z,
zorro_set_drvdata(z, info);

ret = cirrusfb_register(info);
if (ret) {
if (btype == BT_PICASSO4) {
iounmap(info->screen_base);
iounmap(cinfo->regbase - 0x600000);
} else if (board_addr > 0x01000000)
iounmap(info->screen_base);
}
return ret;
if (!ret)
return 0;

if (btype == BT_PICASSO4 || board_addr > 0x01000000)
iounmap(info->screen_base);

err_unmap_regbase:
/* Parental advisory: explicit hack */
iounmap(cinfo->regbase - 0x600000);
if (btype == BT_PICASSO4)
iounmap(cinfo->regbase - 0x600000);
err_release_region:
release_region(board_addr, board_size);
err_release_fb:
Expand Down

0 comments on commit bc5d8ac

Please sign in to comment.