linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: process failure of sysfs_create_group()
@ 2008-11-10 10:53 Jianjun Kong
  2008-11-10 21:30 ` [Linux-fbdev-devel] " Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Jianjun Kong @ 2008-11-10 10:53 UTC (permalink / raw)
  To: spock; +Cc: Linux-Kernel-Mailing-List, linux-fbdev-devel


drivers: drivers/video/uvesafb.c:
When fail to call sysfs_create_group(), it should recycle resources and return the error.
This patch fix for processing failure of sysfs_create_group().

Signed-off-by: Jianjun Kong <jianjun@zeuux.org>
---
 drivers/video/uvesafb.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index 6c2d37f..a78d4d9 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -1811,12 +1811,16 @@ static int __devinit uvesafb_probe(struct platform_device *dev)
 			info->fix.id);
 
 	err = sysfs_create_group(&dev->dev.kobj, &uvesafb_dev_attgrp);
-	if (err != 0)
+	if (err != 0) {
 		printk(KERN_WARNING "fb%d: failed to register attributes\n",
 			info->node);
+		goto out_frame;
+	}
 
 	return 0;
 
+our_frame:
+	unregister_framebuffer(info);
 out_reg:
 	release_region(0x3c0, 32);
 out_unmap:
-- 
1.5.6.3

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

* Re: [Linux-fbdev-devel] [PATCH] drivers: process failure of sysfs_create_group()
  2008-11-10 10:53 [PATCH] drivers: process failure of sysfs_create_group() Jianjun Kong
@ 2008-11-10 21:30 ` Geert Uytterhoeven
  2008-11-11 10:05   ` Michal Januszewski
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2008-11-10 21:30 UTC (permalink / raw)
  To: Jianjun Kong; +Cc: spock, linux-fbdev-devel, Linux-Kernel-Mailing-List

On Mon, 10 Nov 2008, Jianjun Kong wrote:
> drivers: drivers/video/uvesafb.c:
> When fail to call sysfs_create_group(), it should recycle resources and return the error.
> This patch fix for processing failure of sysfs_create_group().

IIRC, the reasoning behind the current code is that a failure to create sysfs
entries is not critical, as it doesn't impact the correct functioning of the
core of the driver.

> Signed-off-by: Jianjun Kong <jianjun@zeuux.org>
> ---
>  drivers/video/uvesafb.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
> index 6c2d37f..a78d4d9 100644
> --- a/drivers/video/uvesafb.c
> +++ b/drivers/video/uvesafb.c
> @@ -1811,12 +1811,16 @@ static int __devinit uvesafb_probe(struct platform_device *dev)
>  			info->fix.id);
>  
>  	err = sysfs_create_group(&dev->dev.kobj, &uvesafb_dev_attgrp);
> -	if (err != 0)
> +	if (err != 0) {
>  		printk(KERN_WARNING "fb%d: failed to register attributes\n",
>  			info->node);
> +		goto out_frame;
> +	}
>  
>  	return 0;
>  
> +our_frame:
> +	unregister_framebuffer(info);
>  out_reg:
>  	release_region(0x3c0, 32);
>  out_unmap:

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [Linux-fbdev-devel] [PATCH] drivers: process failure of sysfs_create_group()
  2008-11-10 21:30 ` [Linux-fbdev-devel] " Geert Uytterhoeven
@ 2008-11-11 10:05   ` Michal Januszewski
  2008-11-11 13:30     ` Jianjun Kong
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Januszewski @ 2008-11-11 10:05 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Jianjun Kong, linux-fbdev-devel, Linux-Kernel-Mailing-List

On Mon, Nov 10, 2008 at 22:30, Geert Uytterhoeven <geert@linux-m68k.org> wrote:

>> When fail to call sysfs_create_group(), it should recycle resources and return the error.
>> This patch fix for processing failure of sysfs_create_group().
>
> IIRC, the reasoning behind the current code is that a failure to create sysfs
> entries is not critical, as it doesn't impact the correct functioning of the
> core of the driver.

That's correct -- that was exactly my reasoning behind this code.

-- 
Michal Januszewski, Gentoo Linux Developer
http://people.gentoo.org/spock

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

* Re: [PATCH] drivers: process failure of sysfs_create_group()
  2008-11-11 10:05   ` Michal Januszewski
@ 2008-11-11 13:30     ` Jianjun Kong
  0 siblings, 0 replies; 4+ messages in thread
From: Jianjun Kong @ 2008-11-11 13:30 UTC (permalink / raw)
  To: Michal Januszewski; +Cc: linux-fbdev-devel, Geert Uytterhoeven

On Tue, Nov 11, 2008 at 11:05:15AM +0100, Michal Januszewski wrote:
>On Mon, Nov 10, 2008 at 22:30, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
>>> When fail to call sysfs_create_group(), it should recycle resources and return the error.
>>> This patch fix for processing failure of sysfs_create_group().
>>
>> IIRC, the reasoning behind the current code is that a failure to create sysfs
>> entries is not critical, as it doesn't impact the correct functioning of the
>> core of the driver.
>
>That's correct -- that was exactly my reasoning behind this code.

Thanks for your confirm.

-- 
Jianjun Kong @_@ Happy Hacking
Homepage: http://kongove.cn/
Gtalk: kongjianjun@gmail.com

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

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

end of thread, other threads:[~2008-11-11 13:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-10 10:53 [PATCH] drivers: process failure of sysfs_create_group() Jianjun Kong
2008-11-10 21:30 ` [Linux-fbdev-devel] " Geert Uytterhoeven
2008-11-11 10:05   ` Michal Januszewski
2008-11-11 13:30     ` Jianjun Kong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).