diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-01-29 21:51:36 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-01-29 21:51:36 -0500 |
commit | 2e9d675ed24bcefd0d99b531a9d7faf794b762c8 (patch) | |
tree | f7a13d803b5b69367bbba67c6c41f8d31f62f66e /drivers/input/joystick/db9.c | |
parent | 84c61896bd756a440c54be07b6e97ad230f31a16 (diff) |
Input: db9 - handle errors from input_register_device()
Also db9_remove shouldn't be marked __exit as it is also called from
__init code.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/joystick/db9.c')
-rw-r--r-- | drivers/input/joystick/db9.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c index 98479b82842d..dcffc34f30c3 100644 --- a/drivers/input/joystick/db9.c +++ b/drivers/input/joystick/db9.c | |||
@@ -616,7 +616,7 @@ static struct db9 __init *db9_probe(int parport, int mode) | |||
616 | if (!input_dev) { | 616 | if (!input_dev) { |
617 | printk(KERN_ERR "db9.c: Not enough memory for input device\n"); | 617 | printk(KERN_ERR "db9.c: Not enough memory for input device\n"); |
618 | err = -ENOMEM; | 618 | err = -ENOMEM; |
619 | goto err_free_devs; | 619 | goto err_unreg_devs; |
620 | } | 620 | } |
621 | 621 | ||
622 | sprintf(db9->phys[i], "%s/input%d", db9->pd->port->name, i); | 622 | sprintf(db9->phys[i], "%s/input%d", db9->pd->port->name, i); |
@@ -642,13 +642,17 @@ static struct db9 __init *db9_probe(int parport, int mode) | |||
642 | input_set_abs_params(input_dev, db9_abs[j], 1, 255, 0, 0); | 642 | input_set_abs_params(input_dev, db9_abs[j], 1, 255, 0, 0); |
643 | } | 643 | } |
644 | 644 | ||
645 | input_register_device(input_dev); | 645 | err = input_register_device(input_dev); |
646 | if (err) | ||
647 | goto err_free_dev; | ||
646 | } | 648 | } |
647 | 649 | ||
648 | parport_put_port(pp); | 650 | parport_put_port(pp); |
649 | return db9; | 651 | return db9; |
650 | 652 | ||
651 | err_free_devs: | 653 | err_free_dev: |
654 | input_free_device(db9->dev[i]); | ||
655 | err_unreg_devs: | ||
652 | while (--i >= 0) | 656 | while (--i >= 0) |
653 | input_unregister_device(db9->dev[i]); | 657 | input_unregister_device(db9->dev[i]); |
654 | kfree(db9); | 658 | kfree(db9); |
@@ -660,7 +664,7 @@ static struct db9 __init *db9_probe(int parport, int mode) | |||
660 | return ERR_PTR(err); | 664 | return ERR_PTR(err); |
661 | } | 665 | } |
662 | 666 | ||
663 | static void __exit db9_remove(struct db9 *db9) | 667 | static void db9_remove(struct db9 *db9) |
664 | { | 668 | { |
665 | int i; | 669 | int i; |
666 | 670 | ||
@@ -698,7 +702,8 @@ static int __init db9_init(void) | |||
698 | 702 | ||
699 | if (err) { | 703 | if (err) { |
700 | while (--i >= 0) | 704 | while (--i >= 0) |
701 | db9_remove(db9_base[i]); | 705 | if (db9_base[i]) |
706 | db9_remove(db9_base[i]); | ||
702 | return err; | 707 | return err; |
703 | } | 708 | } |
704 | 709 | ||