aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mousedev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/mousedev.c')
-rw-r--r--drivers/input/mousedev.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index cd02f1b62b66..a22a74a2a3dc 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -738,7 +738,12 @@ static int psaux_registered;
738 738
739static int __init mousedev_init(void) 739static int __init mousedev_init(void)
740{ 740{
741 input_register_handler(&mousedev_handler); 741 struct class_device *cdev;
742 int error;
743
744 error = input_register_handler(&mousedev_handler);
745 if (error)
746 return error;
742 747
743 memset(&mousedev_mix, 0, sizeof(struct mousedev)); 748 memset(&mousedev_mix, 0, sizeof(struct mousedev));
744 INIT_LIST_HEAD(&mousedev_mix.list); 749 INIT_LIST_HEAD(&mousedev_mix.list);
@@ -747,12 +752,20 @@ static int __init mousedev_init(void)
747 mousedev_mix.exist = 1; 752 mousedev_mix.exist = 1;
748 mousedev_mix.minor = MOUSEDEV_MIX; 753 mousedev_mix.minor = MOUSEDEV_MIX;
749 754
750 class_device_create(&input_class, NULL, 755 cdev = class_device_create(&input_class, NULL,
751 MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), NULL, "mice"); 756 MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), NULL, "mice");
757 if (IS_ERR(cdev)) {
758 input_unregister_handler(&mousedev_handler);
759 return PTR_ERR(cdev);
760 }
752 761
753#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX 762#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
754 if (!(psaux_registered = !misc_register(&psaux_mouse))) 763 error = misc_register(&psaux_mouse);
755 printk(KERN_WARNING "mice: could not misc_register the device\n"); 764 if (error)
765 printk(KERN_WARNING "mice: could not register psaux device, "
766 "error: %d\n", error);
767 else
768 psaux_registered = 1;
756#endif 769#endif
757 770
758 printk(KERN_INFO "mice: PS/2 mouse device common for all mice\n"); 771 printk(KERN_INFO "mice: PS/2 mouse device common for all mice\n");