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 | ccb121e6958eca5f58938e56523fc589fed36fa8 (patch) | |
tree | 9380a8baa7ea3eff8d273af55fcb0d5fac2f3241 /drivers | |
parent | 175b39fb7e145e1aa06f6369c1fbea16873dee9e (diff) |
valkyriefb: 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')
-rw-r--r-- | drivers/video/valkyriefb.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/video/valkyriefb.c b/drivers/video/valkyriefb.c index 7b0cef9ca8f9..4bb9a0b18950 100644 --- a/drivers/video/valkyriefb.c +++ b/drivers/video/valkyriefb.c | |||
@@ -119,7 +119,7 @@ static void set_valkyrie_clock(unsigned char *params); | |||
119 | static int valkyrie_var_to_par(struct fb_var_screeninfo *var, | 119 | static int valkyrie_var_to_par(struct fb_var_screeninfo *var, |
120 | struct fb_par_valkyrie *par, const struct fb_info *fb_info); | 120 | struct fb_par_valkyrie *par, const struct fb_info *fb_info); |
121 | 121 | ||
122 | static void valkyrie_init_info(struct fb_info *info, struct fb_info_valkyrie *p); | 122 | static int valkyrie_init_info(struct fb_info *info, struct fb_info_valkyrie *p); |
123 | static void valkyrie_par_to_fix(struct fb_par_valkyrie *par, struct fb_fix_screeninfo *fix); | 123 | static void valkyrie_par_to_fix(struct fb_par_valkyrie *par, struct fb_fix_screeninfo *fix); |
124 | static void valkyrie_init_fix(struct fb_fix_screeninfo *fix, struct fb_info_valkyrie *p); | 124 | static void valkyrie_init_fix(struct fb_fix_screeninfo *fix, struct fb_info_valkyrie *p); |
125 | 125 | ||
@@ -381,18 +381,22 @@ int __init valkyriefb_init(void) | |||
381 | 381 | ||
382 | valkyrie_choose_mode(p); | 382 | valkyrie_choose_mode(p); |
383 | mac_vmode_to_var(default_vmode, default_cmode, &p->info.var); | 383 | mac_vmode_to_var(default_vmode, default_cmode, &p->info.var); |
384 | valkyrie_init_info(&p->info, p); | 384 | err = valkyrie_init_info(&p->info, p); |
385 | if (err < 0) | ||
386 | goto out_free; | ||
385 | valkyrie_init_fix(&p->info.fix, p); | 387 | valkyrie_init_fix(&p->info.fix, p); |
386 | if (valkyriefb_set_par(&p->info)) | 388 | if (valkyriefb_set_par(&p->info)) |
387 | /* "can't happen" */ | 389 | /* "can't happen" */ |
388 | printk(KERN_ERR "valkyriefb: can't set default video mode\n"); | 390 | printk(KERN_ERR "valkyriefb: can't set default video mode\n"); |
389 | 391 | ||
390 | if ((err = register_framebuffer(&p->info)) != 0) | 392 | if ((err = register_framebuffer(&p->info)) != 0) |
391 | goto out_free; | 393 | goto out_cmap_free; |
392 | 394 | ||
393 | printk(KERN_INFO "fb%d: valkyrie frame buffer device\n", p->info.node); | 395 | printk(KERN_INFO "fb%d: valkyrie frame buffer device\n", p->info.node); |
394 | return 0; | 396 | return 0; |
395 | 397 | ||
398 | out_cmap_free: | ||
399 | fb_dealloc_cmap(&p->info.cmap); | ||
396 | out_free: | 400 | out_free: |
397 | if (p->frame_buffer) | 401 | if (p->frame_buffer) |
398 | iounmap(p->frame_buffer); | 402 | iounmap(p->frame_buffer); |
@@ -538,14 +542,15 @@ static void valkyrie_par_to_fix(struct fb_par_valkyrie *par, | |||
538 | /* ywrapstep, xpanstep, ypanstep */ | 542 | /* ywrapstep, xpanstep, ypanstep */ |
539 | } | 543 | } |
540 | 544 | ||
541 | static void __init valkyrie_init_info(struct fb_info *info, struct fb_info_valkyrie *p) | 545 | static int __init valkyrie_init_info(struct fb_info *info, |
546 | struct fb_info_valkyrie *p) | ||
542 | { | 547 | { |
543 | info->fbops = &valkyriefb_ops; | 548 | info->fbops = &valkyriefb_ops; |
544 | info->screen_base = p->frame_buffer + 0x1000; | 549 | info->screen_base = p->frame_buffer + 0x1000; |
545 | info->flags = FBINFO_DEFAULT; | 550 | info->flags = FBINFO_DEFAULT; |
546 | info->pseudo_palette = p->pseudo_palette; | 551 | info->pseudo_palette = p->pseudo_palette; |
547 | fb_alloc_cmap(&info->cmap, 256, 0); | ||
548 | info->par = &p->par; | 552 | info->par = &p->par; |
553 | return fb_alloc_cmap(&info->cmap, 256, 0); | ||
549 | } | 554 | } |
550 | 555 | ||
551 | 556 | ||