Input: handle serio_register_driver() errors
authorAkinobu Mita <akinobu.mita@gmail.com>
Fri, 24 Nov 2006 04:35:10 +0000 (23:35 -0500)
committerDmitry Torokhov <dtor@insightbb.com>
Fri, 24 Nov 2006 04:35:10 +0000 (23:35 -0500)
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
26 files changed:
drivers/input/joystick/iforce/iforce-main.c
drivers/input/joystick/magellan.c
drivers/input/joystick/spaceball.c
drivers/input/joystick/spaceorb.c
drivers/input/joystick/stinger.c
drivers/input/joystick/twidjoy.c
drivers/input/joystick/warrior.c
drivers/input/keyboard/atkbd.c
drivers/input/keyboard/hil_kbd.c
drivers/input/keyboard/lkkbd.c
drivers/input/keyboard/newtonkbd.c
drivers/input/keyboard/stowaway.c
drivers/input/keyboard/sunkbd.c
drivers/input/keyboard/xtkbd.c
drivers/input/mouse/hil_ptr.c
drivers/input/mouse/psmouse-base.c
drivers/input/mouse/sermouse.c
drivers/input/mouse/vsxxxaa.c
drivers/input/serio/serio_raw.c
drivers/input/touchscreen/elo.c
drivers/input/touchscreen/gunze.c
drivers/input/touchscreen/h3600_ts_input.c
drivers/input/touchscreen/mtouch.c
drivers/input/touchscreen/penmount.c
drivers/input/touchscreen/touchright.c
drivers/input/touchscreen/touchwin.c

index 706e0aea793c6377fc05325fe00f52cff8d914ed..3393a37fec399593ad4dd0f264e401157f80300d 100644 (file)
@@ -467,13 +467,21 @@ int iforce_init_device(struct iforce *iforce)
 
 static int __init iforce_init(void)
 {
+       int err = 0;
+
 #ifdef CONFIG_JOYSTICK_IFORCE_USB
-       usb_register(&iforce_usb_driver);
+       err = usb_register(&iforce_usb_driver);
+       if (err)
+               return err;
 #endif
 #ifdef CONFIG_JOYSTICK_IFORCE_232
-       serio_register_driver(&iforce_serio_drv);
+       err = serio_register_driver(&iforce_serio_drv);
+#ifdef CONFIG_JOYSTICK_IFORCE_USB
+       if (err)
+               usb_deregister(&iforce_usb_driver);
 #endif
-       return 0;
+#endif
+       return err;
 }
 
 static void __exit iforce_exit(void)
index d512b0a0282e90bbd1444b777ef1a6cc86ea0cc4..4112789f11966a2433e4c570da06962915161e1d 100644 (file)
@@ -231,8 +231,7 @@ static struct serio_driver magellan_drv = {
 
 static int __init magellan_init(void)
 {
-       serio_register_driver(&magellan_drv);
-       return 0;
+       return serio_register_driver(&magellan_drv);
 }
 
 static void __exit magellan_exit(void)
index 9b3597343c1cb87db0143b7faafbbe83e490f528..08bf113e62ebd0d32e6a3fbfe42a4f8868a5d5ad 100644 (file)
@@ -300,8 +300,7 @@ static struct serio_driver spaceball_drv = {
 
 static int __init spaceball_init(void)
 {
-       serio_register_driver(&spaceball_drv);
-       return 0;
+       return serio_register_driver(&spaceball_drv);
 }
 
 static void __exit spaceball_exit(void)
index ea9d51e70a125424ad4e97c9e63993ad90f8edff..c9c79211af711c3b9a5631331612749b352b350f 100644 (file)
@@ -246,8 +246,7 @@ static struct serio_driver spaceorb_drv = {
 
 static int __init spaceorb_init(void)
 {
-       serio_register_driver(&spaceorb_drv);
-       return 0;
+       return serio_register_driver(&spaceorb_drv);
 }
 
 static void __exit spaceorb_exit(void)
index b51a4a4c7f60050aa4779f6be44e82c62f50026b..ecb0916215fa05d3943e7a548e70d16fb1ea557e 100644 (file)
@@ -216,8 +216,7 @@ static struct serio_driver stinger_drv = {
 
 static int __init stinger_init(void)
 {
-       serio_register_driver(&stinger_drv);
-       return 0;
+       return serio_register_driver(&stinger_drv);
 }
 
 static void __exit stinger_exit(void)
index 3c1c83e8609aec92ded893d475803a3bff3e2645..9cf17d6ced820ca2c891669674bea3813078404e 100644 (file)
@@ -269,8 +269,7 @@ static struct serio_driver twidjoy_drv = {
 
 static int __init twidjoy_init(void)
 {
-       serio_register_driver(&twidjoy_drv);
-       return 0;
+       return serio_register_driver(&twidjoy_drv);
 }
 
 static void __exit twidjoy_exit(void)
index 1e4828b9a1ab97327b7ec9dbf60db519f3f9e13a..29d339acf4307b451087c2b93831adee544648f1 100644 (file)
@@ -224,8 +224,7 @@ static struct serio_driver warrior_drv = {
 
 static int __init warrior_init(void)
 {
-       serio_register_driver(&warrior_drv);
-       return 0;
+       return serio_register_driver(&warrior_drv);
 }
 
 static void __exit warrior_exit(void)
index 73c6946b2d92bdbce19b4632d72c9dff7549d7fe..498e64a00e3cf51044515a10f37d8481403f4ebc 100644 (file)
@@ -1389,8 +1389,7 @@ static ssize_t atkbd_show_err_count(struct atkbd *atkbd, char *buf)
 
 static int __init atkbd_init(void)
 {
-       serio_register_driver(&atkbd_drv);
-       return 0;
+       return serio_register_driver(&atkbd_drv);
 }
 
 static void __exit atkbd_exit(void)
index e774dd31e99b7bf2ca7d2503f5d84decb08b1daa..7cc9728b04df5559b65f71cd8d7131e0d12d88bc 100644 (file)
@@ -381,8 +381,7 @@ struct serio_driver hil_kbd_serio_drv = {
 
 static int __init hil_kbd_init(void)
 {
-       serio_register_driver(&hil_kbd_serio_drv);
-        return 0;
+       return serio_register_driver(&hil_kbd_serio_drv);
 }
                 
 static void __exit hil_kbd_exit(void)
index 0067c1fe3d4eceb6e6e4944eafc219ec8858171a..1789785813ee5c350434845b9611cd5d4d02a62d 100644 (file)
@@ -758,8 +758,7 @@ static struct serio_driver lkkbd_drv = {
 static int __init
 lkkbd_init (void)
 {
-       serio_register_driver(&lkkbd_drv);
-       return 0;
+       return serio_register_driver(&lkkbd_drv);
 }
 
 static void __exit
index 33e813948d6f05b6da023ac991b961d76de984a5..aa29b50765c942af946d0ef79730a8ff0872cb81 100644 (file)
@@ -169,8 +169,7 @@ static struct serio_driver nkbd_drv = {
 
 static int __init nkbd_init(void)
 {
-       serio_register_driver(&nkbd_drv);
-       return 0;
+       return serio_register_driver(&nkbd_drv);
 }
 
 static void __exit nkbd_exit(void)
index e60937d17b1c286a6341b0d3adf3b0645352a079..f7b5c5b8145162c654bd8a5c783d43e4c0abbdaa 100644 (file)
@@ -173,8 +173,7 @@ static struct serio_driver skbd_drv = {
 
 static int __init skbd_init(void)
 {
-       serio_register_driver(&skbd_drv);
-       return 0;
+       return serio_register_driver(&skbd_drv);
 }
 
 static void __exit skbd_exit(void)
index d1b62f77a7160d0862bee44a5c43d51466de1618..d6ab6d4b1fa87576e9bbce4fec844cd801904595 100644 (file)
@@ -352,8 +352,7 @@ static struct serio_driver sunkbd_drv = {
 
 static int __init sunkbd_init(void)
 {
-       serio_register_driver(&sunkbd_drv);
-       return 0;
+       return serio_register_driver(&sunkbd_drv);
 }
 
 static void __exit sunkbd_exit(void)
index b53f716385835570047a0879b4ca4f981f209c90..a8209343213860bf96157bb401aa4cc0a9e02b6e 100644 (file)
@@ -174,8 +174,7 @@ static struct serio_driver xtkbd_drv = {
 
 static int __init xtkbd_init(void)
 {
-       serio_register_driver(&xtkbd_drv);
-       return 0;
+       return serio_register_driver(&xtkbd_drv);
 }
 
 static void __exit xtkbd_exit(void)
index 4f2b503c1ac72ee1d05ab2533f97f46d1193a3e2..bfb174fe32305ab315411da0b2df21e4127e03c3 100644 (file)
@@ -417,8 +417,7 @@ static struct serio_driver hil_ptr_serio_driver = {
 
 static int __init hil_ptr_init(void)
 {
-       serio_register_driver(&hil_ptr_serio_driver);
-        return 0;
+       return serio_register_driver(&hil_ptr_serio_driver);
 }
                 
 static void __exit hil_ptr_exit(void)
index 58beca99a9c3ec70bcea79b42a355b37952c40c9..e626b1e737fa46a076402453c4ad4817d812f961 100644 (file)
@@ -1524,15 +1524,19 @@ static int psmouse_get_maxproto(char *buffer, struct kernel_param *kp)
 
 static int __init psmouse_init(void)
 {
+       int err;
+
        kpsmoused_wq = create_singlethread_workqueue("kpsmoused");
        if (!kpsmoused_wq) {
                printk(KERN_ERR "psmouse: failed to create kpsmoused workqueue\n");
                return -ENOMEM;
        }
 
-       serio_register_driver(&psmouse_drv);
+       err = serio_register_driver(&psmouse_drv);
+       if (err)
+               destroy_workqueue(kpsmoused_wq);
 
-       return 0;
+       return err;
 }
 
 static void __exit psmouse_exit(void)
index 10b51e7f01f6923ebed79d511f5ba10e28351ec3..a85d74710b44cd3d474ba79562e698005420880b 100644 (file)
@@ -351,8 +351,7 @@ static struct serio_driver sermouse_drv = {
 
 static int __init sermouse_init(void)
 {
-       serio_register_driver(&sermouse_drv);
-       return 0;
+       return serio_register_driver(&sermouse_drv);
 }
 
 static void __exit sermouse_exit(void)
index ffd0d6624a8c726ed40913a22fb1cbd717ea264d..c3d64fcc858d26f0e3104d2c23328d6aa0d60c5a 100644 (file)
@@ -574,8 +574,7 @@ static struct serio_driver vsxxxaa_drv = {
 static int __init
 vsxxxaa_init (void)
 {
-       serio_register_driver(&vsxxxaa_drv);
-       return 0;
+       return serio_register_driver(&vsxxxaa_drv);
 }
 
 static void __exit
index ba2a2035d6483467680d94dd54df397f0780526a..0e343a6cacc9b82a9d4ebbca8f1bdbbfb28b279b 100644 (file)
@@ -389,8 +389,7 @@ static struct serio_driver serio_raw_drv = {
 
 static int __init serio_raw_init(void)
 {
-       serio_register_driver(&serio_raw_drv);
-       return 0;
+       return serio_register_driver(&serio_raw_drv);
 }
 
 static void __exit serio_raw_exit(void)
index 913e1b73bb0e6780b44a57dcfd16f5b6d06b6a51..9d61cd133d0179305f796a668768ce2ab37d3061 100644 (file)
@@ -397,8 +397,7 @@ static struct serio_driver elo_drv = {
 
 static int __init elo_init(void)
 {
-       serio_register_driver(&elo_drv);
-       return 0;
+       return serio_register_driver(&elo_drv);
 }
 
 static void __exit elo_exit(void)
index 44f397fff71534877a23459fcf152b08d3cd722b..9157eb148e84cb784130652bb0c50a4a9649a6b3 100644 (file)
@@ -194,8 +194,7 @@ static struct serio_driver gunze_drv = {
 
 static int __init gunze_init(void)
 {
-       serio_register_driver(&gunze_drv);
-       return 0;
+       return serio_register_driver(&gunze_drv);
 }
 
 static void __exit gunze_exit(void)
index d9e61ee05ea94dfdf35e9307bb2de1f4808545fd..c4116d4f64e7ae5d85424dfa0cb02c450b758b84 100644 (file)
@@ -478,8 +478,7 @@ static struct serio_driver h3600ts_drv = {
 
 static int __init h3600ts_init(void)
 {
-       serio_register_driver(&h3600ts_drv);
-       return 0;
+       return serio_register_driver(&h3600ts_drv);
 }
 
 static void __exit h3600ts_exit(void)
index c66b399774f227a67256d3837ea27f9c155608f9..c3c2d735d0ec70c4f7a06d7e6bbe8db418767e0e 100644 (file)
@@ -208,8 +208,7 @@ static struct serio_driver mtouch_drv = {
 
 static int __init mtouch_init(void)
 {
-       serio_register_driver(&mtouch_drv);
-       return 0;
+       return serio_register_driver(&mtouch_drv);
 }
 
 static void __exit mtouch_exit(void)
index 6c7d0c2c76ccd79e976bee8e260ae43a6eda098e..bd2767991ae9b89cc1646d7061b5b3b0c207909a 100644 (file)
@@ -171,8 +171,7 @@ static struct serio_driver pm_drv = {
 
 static int __init pm_init(void)
 {
-       serio_register_driver(&pm_drv);
-       return 0;
+       return serio_register_driver(&pm_drv);
 }
 
 static void __exit pm_exit(void)
index c74f74e57af02fb1678880a236de82529b80e1da..35ba46c6ad2d3f77530da62710d6ffacf72792aa 100644 (file)
@@ -182,8 +182,7 @@ static struct serio_driver tr_drv = {
 
 static int __init tr_init(void)
 {
-       serio_register_driver(&tr_drv);
-       return 0;
+       return serio_register_driver(&tr_drv);
 }
 
 static void __exit tr_exit(void)
index 9911820fa2fe9f67123f6eb580101abad77d5629..4dc073dacabbdbb2080d71fe15106422d5557342 100644 (file)
@@ -189,8 +189,7 @@ static struct serio_driver tw_drv = {
 
 static int __init tw_init(void)
 {
-       serio_register_driver(&tw_drv);
-       return 0;
+       return serio_register_driver(&tw_drv);
 }
 
 static void __exit tw_exit(void)