mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 9/15] valkyriefb: check fb_alloc_cmap return value and handle failure properly
@ 2009-02-07 17:15 Andres Salomon
  2009-02-09 17:06 ` [Linux-fbdev-devel] " Krzysztof Helt
  0 siblings, 1 reply; 2+ messages in thread
From: Andres Salomon @ 2009-02-07 17:15 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linux-fbdev-devel, adaplas


Signed-off-by: Andres Salomon <dilinger@debian.org>
---
 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 7b0cef9..4bb9a0b 100644
--- a/drivers/video/valkyriefb.c
+++ b/drivers/video/valkyriefb.c
@@ -119,7 +119,7 @@ static void set_valkyrie_clock(unsigned char *params);
 static int valkyrie_var_to_par(struct fb_var_screeninfo *var,
 	struct fb_par_valkyrie *par, const struct fb_info *fb_info);
 
-static void valkyrie_init_info(struct fb_info *info, struct fb_info_valkyrie *p);
+static int valkyrie_init_info(struct fb_info *info, struct fb_info_valkyrie *p);
 static void valkyrie_par_to_fix(struct fb_par_valkyrie *par, struct fb_fix_screeninfo *fix);
 static void valkyrie_init_fix(struct fb_fix_screeninfo *fix, struct fb_info_valkyrie *p);
 
@@ -381,18 +381,22 @@ int __init valkyriefb_init(void)
 
 	valkyrie_choose_mode(p);
 	mac_vmode_to_var(default_vmode, default_cmode, &p->info.var);
-	valkyrie_init_info(&p->info, p);
+	err = valkyrie_init_info(&p->info, p);
+	if (err < 0)
+		goto out_free;
 	valkyrie_init_fix(&p->info.fix, p);
 	if (valkyriefb_set_par(&p->info))
 		/* "can't happen" */
 		printk(KERN_ERR "valkyriefb: can't set default video mode\n");
 
 	if ((err = register_framebuffer(&p->info)) != 0)
-		goto out_free;
+		goto out_cmap_free;
 
 	printk(KERN_INFO "fb%d: valkyrie frame buffer device\n", p->info.node);
 	return 0;
 
+ out_cmap_free:
+	fb_dealloc_cmap(&p->info.cmap);
  out_free:
 	if (p->frame_buffer)
 		iounmap(p->frame_buffer);
@@ -538,14 +542,15 @@ static void valkyrie_par_to_fix(struct fb_par_valkyrie *par,
 		/* ywrapstep, xpanstep, ypanstep */
 }
 
-static void __init valkyrie_init_info(struct fb_info *info, struct fb_info_valkyrie *p)
+static int __init valkyrie_init_info(struct fb_info *info,
+		struct fb_info_valkyrie *p)
 {
 	info->fbops = &valkyriefb_ops;
 	info->screen_base = p->frame_buffer + 0x1000;
 	info->flags = FBINFO_DEFAULT;
 	info->pseudo_palette = p->pseudo_palette;
-	fb_alloc_cmap(&info->cmap, 256, 0);
 	info->par = &p->par;
+	return fb_alloc_cmap(&info->cmap, 256, 0);
 }
 
 
-- 
1.5.6.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Linux-fbdev-devel] [PATCH 9/15] valkyriefb: check fb_alloc_cmap return value and handle failure properly
  2009-02-07 17:15 [PATCH 9/15] valkyriefb: check fb_alloc_cmap return value and handle failure properly Andres Salomon
@ 2009-02-09 17:06 ` Krzysztof Helt
  0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Helt @ 2009-02-09 17:06 UTC (permalink / raw)
  To: Andres Salomon; +Cc: Andrew Morton, linux-fbdev-devel, linux-kernel, adaplas

On Sat, 7 Feb 2009 12:15:26 -0500
Andres Salomon <dilinger@queued.net> wrote:

> 
> Signed-off-by: Andres Salomon <dilinger@debian.org>
> ---

Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>


>  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 7b0cef9..4bb9a0b 100644
> --- a/drivers/video/valkyriefb.c
> +++ b/drivers/video/valkyriefb.c
> @@ -119,7 +119,7 @@ static void set_valkyrie_clock(unsigned char *params);
>  static int valkyrie_var_to_par(struct fb_var_screeninfo *var,
>  	struct fb_par_valkyrie *par, const struct fb_info *fb_info);
>  
> -static void valkyrie_init_info(struct fb_info *info, struct fb_info_valkyrie *p);
> +static int valkyrie_init_info(struct fb_info *info, struct fb_info_valkyrie *p);
>  static void valkyrie_par_to_fix(struct fb_par_valkyrie *par, struct fb_fix_screeninfo *fix);
>  static void valkyrie_init_fix(struct fb_fix_screeninfo *fix, struct fb_info_valkyrie *p);
>  
> @@ -381,18 +381,22 @@ int __init valkyriefb_init(void)
>  
>  	valkyrie_choose_mode(p);
>  	mac_vmode_to_var(default_vmode, default_cmode, &p->info.var);
> -	valkyrie_init_info(&p->info, p);
> +	err = valkyrie_init_info(&p->info, p);
> +	if (err < 0)
> +		goto out_free;
>  	valkyrie_init_fix(&p->info.fix, p);
>  	if (valkyriefb_set_par(&p->info))
>  		/* "can't happen" */
>  		printk(KERN_ERR "valkyriefb: can't set default video mode\n");
>  
>  	if ((err = register_framebuffer(&p->info)) != 0)
> -		goto out_free;
> +		goto out_cmap_free;
>  
>  	printk(KERN_INFO "fb%d: valkyrie frame buffer device\n", p->info.node);
>  	return 0;
>  
> + out_cmap_free:
> +	fb_dealloc_cmap(&p->info.cmap);
>   out_free:
>  	if (p->frame_buffer)
>  		iounmap(p->frame_buffer);
> @@ -538,14 +542,15 @@ static void valkyrie_par_to_fix(struct fb_par_valkyrie *par,
>  		/* ywrapstep, xpanstep, ypanstep */
>  }
>  
> -static void __init valkyrie_init_info(struct fb_info *info, struct fb_info_valkyrie *p)
> +static int __init valkyrie_init_info(struct fb_info *info,
> +		struct fb_info_valkyrie *p)
>  {
>  	info->fbops = &valkyriefb_ops;
>  	info->screen_base = p->frame_buffer + 0x1000;
>  	info->flags = FBINFO_DEFAULT;
>  	info->pseudo_palette = p->pseudo_palette;
> -	fb_alloc_cmap(&info->cmap, 256, 0);
>  	info->par = &p->par;
> +	return fb_alloc_cmap(&info->cmap, 256, 0);
>  }
>  
>  
> -- 
> 1.5.6.5
> 
> 
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-02-09 17:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-07 17:15 [PATCH 9/15] valkyriefb: check fb_alloc_cmap return value and handle failure properly Andres Salomon
2009-02-09 17:06 ` [Linux-fbdev-devel] " Krzysztof Helt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®