diff options
author | Andres Salomon <dilinger@queued.net> | 2009-03-31 18:25:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 11:59:31 -0400 |
commit | 175b39fb7e145e1aa06f6369c1fbea16873dee9e (patch) | |
tree | ff45d85b1c7898e8177bc4e95352634656ca3a29 /drivers/video/stifb.c | |
parent | c23124277e58998703278c26c53b159cea0f9643 (diff) |
stifb: check fb_alloc_cmap return value and handle failure properly
Signed-off-by: Andres Salomon <dilinger@debian.org>
Acked-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>
Diffstat (limited to 'drivers/video/stifb.c')
-rw-r--r-- | drivers/video/stifb.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c index 166481402412..eabaad765aeb 100644 --- a/drivers/video/stifb.c +++ b/drivers/video/stifb.c | |||
@@ -1262,24 +1262,25 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) | |||
1262 | info->flags = FBINFO_DEFAULT; | 1262 | info->flags = FBINFO_DEFAULT; |
1263 | info->pseudo_palette = &fb->pseudo_palette; | 1263 | info->pseudo_palette = &fb->pseudo_palette; |
1264 | 1264 | ||
1265 | /* This has to been done !!! */ | 1265 | /* This has to be done !!! */ |
1266 | fb_alloc_cmap(&info->cmap, NR_PALETTE, 0); | 1266 | if (fb_alloc_cmap(&info->cmap, NR_PALETTE, 0)) |
1267 | goto out_err1; | ||
1267 | stifb_init_display(fb); | 1268 | stifb_init_display(fb); |
1268 | 1269 | ||
1269 | if (!request_mem_region(fix->smem_start, fix->smem_len, "stifb fb")) { | 1270 | if (!request_mem_region(fix->smem_start, fix->smem_len, "stifb fb")) { |
1270 | printk(KERN_ERR "stifb: cannot reserve fb region 0x%04lx-0x%04lx\n", | 1271 | printk(KERN_ERR "stifb: cannot reserve fb region 0x%04lx-0x%04lx\n", |
1271 | fix->smem_start, fix->smem_start+fix->smem_len); | 1272 | fix->smem_start, fix->smem_start+fix->smem_len); |
1272 | goto out_err1; | 1273 | goto out_err2; |
1273 | } | 1274 | } |
1274 | 1275 | ||
1275 | if (!request_mem_region(fix->mmio_start, fix->mmio_len, "stifb mmio")) { | 1276 | if (!request_mem_region(fix->mmio_start, fix->mmio_len, "stifb mmio")) { |
1276 | printk(KERN_ERR "stifb: cannot reserve sti mmio region 0x%04lx-0x%04lx\n", | 1277 | printk(KERN_ERR "stifb: cannot reserve sti mmio region 0x%04lx-0x%04lx\n", |
1277 | fix->mmio_start, fix->mmio_start+fix->mmio_len); | 1278 | fix->mmio_start, fix->mmio_start+fix->mmio_len); |
1278 | goto out_err2; | 1279 | goto out_err3; |
1279 | } | 1280 | } |
1280 | 1281 | ||
1281 | if (register_framebuffer(&fb->info) < 0) | 1282 | if (register_framebuffer(&fb->info) < 0) |
1282 | goto out_err3; | 1283 | goto out_err4; |
1283 | 1284 | ||
1284 | sti->info = info; /* save for unregister_framebuffer() */ | 1285 | sti->info = info; /* save for unregister_framebuffer() */ |
1285 | 1286 | ||
@@ -1297,13 +1298,14 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) | |||
1297 | return 0; | 1298 | return 0; |
1298 | 1299 | ||
1299 | 1300 | ||
1300 | out_err3: | 1301 | out_err4: |
1301 | release_mem_region(fix->mmio_start, fix->mmio_len); | 1302 | release_mem_region(fix->mmio_start, fix->mmio_len); |
1302 | out_err2: | 1303 | out_err3: |
1303 | release_mem_region(fix->smem_start, fix->smem_len); | 1304 | release_mem_region(fix->smem_start, fix->smem_len); |
1305 | out_err2: | ||
1306 | fb_dealloc_cmap(&info->cmap); | ||
1304 | out_err1: | 1307 | out_err1: |
1305 | iounmap(info->screen_base); | 1308 | iounmap(info->screen_base); |
1306 | fb_dealloc_cmap(&info->cmap); | ||
1307 | out_err0: | 1309 | out_err0: |
1308 | kfree(fb); | 1310 | kfree(fb); |
1309 | return -ENXIO; | 1311 | return -ENXIO; |