lkml.org 
[lkml]   [2004]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] Driver Core update for 2.6.4
Date
From
ChangeSet 1.1608.84.3, 2004/03/10 16:05:00-08:00, chrisw@osdl.org

[PATCH] class_simple clean up in lp

Error condition isn't caught on class_simple_create, and
parport_register_driver failure doesn't do proper cleanup.


drivers/char/lp.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)


diff -Nru a/drivers/char/lp.c b/drivers/char/lp.c
--- a/drivers/char/lp.c Mon Mar 15 15:30:05 2004
+++ b/drivers/char/lp.c Mon Mar 15 15:30:05 2004
@@ -869,7 +869,7 @@

int __init lp_init (void)
{
- int i;
+ int i, err = 0;

if (parport_nr[0] == LP_PARPORT_OFF)
return 0;
@@ -900,10 +900,15 @@

devfs_mk_dir("printers");
lp_class = class_simple_create(THIS_MODULE, "printer");
+ if (IS_ERR(lp_class)) {
+ err = PTR_ERR(lp_class);
+ goto out_devfs;
+ }

if (parport_register_driver (&lp_driver)) {
printk (KERN_ERR "lp: unable to register with parport\n");
- return -EIO;
+ err = -EIO;
+ goto out_class;
}

if (!lp_count) {
@@ -915,6 +920,13 @@
}

return 0;
+
+out_class:
+ class_simple_destroy(lp_class);
+out_devfs:
+ devfs_remove("printers");
+ unregister_chrdev(LP_MAJOR, "lp");
+ return err;
}

static int __init lp_init_module (void)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:01    [W:0.049 / U:0.744 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site