[PATCH] class_simple cleanup in input

From: Chris Wright
Date: Wed Mar 03 2004 - 23:06:29 EST


Doesn't catch error on class_simple_add, and existing error return paths
forget to class_simple_destroy.

===== drivers/input/input.c 1.42 vs edited =====
--- 1.42/drivers/input/input.c Thu Jan 15 03:05:57 2004
+++ edited/drivers/input/input.c Wed Mar 3 19:46:20 2004
@@ -727,6 +727,8 @@
int retval = -ENOMEM;

input_class = class_simple_create(THIS_MODULE, "input");
+ if (IS_ERR(input_class))
+ return PTR_ERR(input_class);
input_proc_init();
retval = register_chrdev(INPUT_MAJOR, "input", &input_fops);
if (retval) {
@@ -734,6 +736,7 @@
remove_proc_entry("devices", proc_bus_input_dir);
remove_proc_entry("handlers", proc_bus_input_dir);
remove_proc_entry("input", proc_bus);
+ class_simple_destroy(input_class);
return retval;
}

@@ -743,6 +746,7 @@
remove_proc_entry("handlers", proc_bus_input_dir);
remove_proc_entry("input", proc_bus);
unregister_chrdev(INPUT_MAJOR, "input");
+ class_simple_destroy(input_class);
}
return retval;
}

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