Commit 0971d142 authored by Michael Still's avatar Michael Still Committed by Vojtech Pavlik

Handle return values from interface_register() and misc_register()

in the input drivers.
parent 18b8c734
...@@ -95,7 +95,12 @@ static struct device_interface evbug_intf = { ...@@ -95,7 +95,12 @@ static struct device_interface evbug_intf = {
int __init evbug_init(void) int __init evbug_init(void)
{ {
interface_register(&evbug_intf); int retval;
retval = interface_register(&evbug_intf);
if(retval < 0)
return retval;
input_register_handler(&evbug_handler); input_register_handler(&evbug_handler);
return 0; return 0;
} }
...@@ -103,7 +108,7 @@ int __init evbug_init(void) ...@@ -103,7 +108,7 @@ int __init evbug_init(void)
void __exit evbug_exit(void) void __exit evbug_exit(void)
{ {
input_unregister_handler(&evbug_handler); input_unregister_handler(&evbug_handler);
interface_register(&evbug_intf); interface_unregister(&evbug_intf);
} }
module_init(evbug_init); module_init(evbug_init);
......
...@@ -442,7 +442,12 @@ static struct device_interface evdev_intf = { ...@@ -442,7 +442,12 @@ static struct device_interface evdev_intf = {
static int __init evdev_init(void) static int __init evdev_init(void)
{ {
interface_register(&evdev_intf); int retval;
retval = interface_register(&evdev_intf);
if(retval < 0)
return retval;
input_register_handler(&evdev_handler); input_register_handler(&evdev_handler);
return 0; return 0;
} }
...@@ -450,7 +455,7 @@ static int __init evdev_init(void) ...@@ -450,7 +455,7 @@ static int __init evdev_init(void)
static void __exit evdev_exit(void) static void __exit evdev_exit(void)
{ {
input_unregister_handler(&evdev_handler); input_unregister_handler(&evdev_handler);
interface_register(&evdev_intf); interface_unregister(&evdev_intf);
} }
module_init(evdev_init); module_init(evdev_init);
......
...@@ -499,7 +499,12 @@ static struct device_interface joydev_intf = { ...@@ -499,7 +499,12 @@ static struct device_interface joydev_intf = {
static int __init joydev_init(void) static int __init joydev_init(void)
{ {
interface_register(&joydev_intf); int retval;
retval = interface_register(&joydev_intf);
if(retval < 0)
return retval;
input_register_handler(&joydev_handler); input_register_handler(&joydev_handler);
return 0; return 0;
} }
......
...@@ -41,6 +41,7 @@ struct mousedev { ...@@ -41,6 +41,7 @@ struct mousedev {
int exist; int exist;
int open; int open;
int minor; int minor;
int misc;
char name[16]; char name[16];
wait_queue_head_t wait; wait_queue_head_t wait;
struct list_head list; struct list_head list;
...@@ -489,7 +490,11 @@ static struct device_interface mousedev_intf = { ...@@ -489,7 +490,11 @@ static struct device_interface mousedev_intf = {
static int __init mousedev_init(void) static int __init mousedev_init(void)
{ {
interface_register(&mousedev_intf); int retval;
if((retval = interface_register(&mousedev_intf)) < 0)
return retval;
input_register_handler(&mousedev_handler); input_register_handler(&mousedev_handler);
memset(&mousedev_mix, 0, sizeof(struct mousedev)); memset(&mousedev_mix, 0, sizeof(struct mousedev));
...@@ -499,8 +504,10 @@ static int __init mousedev_init(void) ...@@ -499,8 +504,10 @@ static int __init mousedev_init(void)
mousedev_mix.exist = 1; mousedev_mix.exist = 1;
mousedev_mix.minor = MOUSEDEV_MIX; mousedev_mix.minor = MOUSEDEV_MIX;
mousedev_mix.devfs = input_register_minor("mice", MOUSEDEV_MIX, MOUSEDEV_MINOR_BASE); mousedev_mix.devfs = input_register_minor("mice", MOUSEDEV_MIX, MOUSEDEV_MINOR_BASE);
#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
misc_register(&psaux_mouse); if (!(mousedev_mix.misc = !misc_register(&psaux_mouse)))
printk(KERN_WARNING "mice: could not misc_register the device\n");
#endif #endif
printk(KERN_INFO "mice: PS/2 mouse device common for all mice\n"); printk(KERN_INFO "mice: PS/2 mouse device common for all mice\n");
...@@ -511,7 +518,8 @@ static int __init mousedev_init(void) ...@@ -511,7 +518,8 @@ static int __init mousedev_init(void)
static void __exit mousedev_exit(void) static void __exit mousedev_exit(void)
{ {
#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
misc_deregister(&psaux_mouse); if (mousedev_mix.misc)
misc_deregister(&psaux_mouse);
#endif #endif
input_unregister_minor(mousedev_mix.devfs); input_unregister_minor(mousedev_mix.devfs);
input_unregister_handler(&mousedev_handler); input_unregister_handler(&mousedev_handler);
......
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