Skip to contentSkip to conversation

drivers: process failure of sysfs_create_group()

PATCH In review Jianjun Kong 3 participants 4 messages Nov 10, 2008 – Nov 11, 2008 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: process failure of sysfs_create_group()

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().

---
 drivers/video/uvesafb.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/video/uvesafb.c +5 -1
index 6c2d37f..a78d4d9 100644
@@ -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:
Signature · 1 line
1.5.6.3
#1 lore raw
Quoted 3 lines · Jianjun Kong

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.

Quoted 17 lines
---
 drivers/video/uvesafb.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/video/uvesafb.c +1 -1
index 6c2d37f..a78d4d9 100644
@@ -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);

drivers/video/uvesafb.c static int __devinit uvesafb_probe(struct platform_device *dev) · line 1826

Quoted 10 lines
drivers/video/uvesafb.c +4 -0
+		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 -- [email protected]

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

#2 lore raw
Quoted 6 lines · Geert Uytterhoeven
Quoted 2 lines

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.

Signature · 2 lines
Michal Januszewski, Gentoo Linux Developer
http://people.gentoo.org/spock
#3 lore raw
Quoted 10 lines · Michal Januszewski
Quoted 6 lines · Geert Uytterhoeven
Quoted 2 lines

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.

Signature · 9 lines
Jianjun Kong @_@ Happy Hacking
Homepage: http://kongove.cn/
Gtalk: [email protected]

-------------------------------------------------------------------------
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=/