Commit 9dc68fe4 authored by Chris Wright's avatar Chris Wright Committed by Greg Kroah-Hartman

[PATCH] class_simple cleanup in input

Doesn't catch error on class_simple_add, and existing error return paths
forget to class_simple_destroy.
parent 717d3071
...@@ -727,6 +727,8 @@ static int __init input_init(void) ...@@ -727,6 +727,8 @@ static int __init input_init(void)
int retval = -ENOMEM; int retval = -ENOMEM;
input_class = class_simple_create(THIS_MODULE, "input"); input_class = class_simple_create(THIS_MODULE, "input");
if (IS_ERR(input_class))
return PTR_ERR(input_class);
input_proc_init(); input_proc_init();
retval = register_chrdev(INPUT_MAJOR, "input", &input_fops); retval = register_chrdev(INPUT_MAJOR, "input", &input_fops);
if (retval) { if (retval) {
...@@ -734,6 +736,7 @@ static int __init input_init(void) ...@@ -734,6 +736,7 @@ static int __init input_init(void)
remove_proc_entry("devices", proc_bus_input_dir); remove_proc_entry("devices", proc_bus_input_dir);
remove_proc_entry("handlers", proc_bus_input_dir); remove_proc_entry("handlers", proc_bus_input_dir);
remove_proc_entry("input", proc_bus); remove_proc_entry("input", proc_bus);
class_simple_destroy(input_class);
return retval; return retval;
} }
...@@ -743,6 +746,7 @@ static int __init input_init(void) ...@@ -743,6 +746,7 @@ static int __init input_init(void)
remove_proc_entry("handlers", proc_bus_input_dir); remove_proc_entry("handlers", proc_bus_input_dir);
remove_proc_entry("input", proc_bus); remove_proc_entry("input", proc_bus);
unregister_chrdev(INPUT_MAJOR, "input"); unregister_chrdev(INPUT_MAJOR, "input");
class_simple_destroy(input_class);
} }
return retval; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment