diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/macintosh/adbhid.c | 10 | ||||
-rw-r--r-- | drivers/macintosh/mac_hid.c | 8 |
2 files changed, 13 insertions, 5 deletions
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c index 5066e7a8ea9c..1c7d6f221b55 100644 --- a/drivers/macintosh/adbhid.c +++ b/drivers/macintosh/adbhid.c | |||
@@ -689,7 +689,6 @@ adbhid_input_register(int id, int default_id, int original_handler_id, | |||
689 | if (!hid || !input_dev) { | 689 | if (!hid || !input_dev) { |
690 | err = -ENOMEM; | 690 | err = -ENOMEM; |
691 | goto fail; | 691 | goto fail; |
692 | |||
693 | } | 692 | } |
694 | 693 | ||
695 | sprintf(hid->phys, "adb%d:%d.%02x/input", id, default_id, original_handler_id); | 694 | sprintf(hid->phys, "adb%d:%d.%02x/input", id, default_id, original_handler_id); |
@@ -807,7 +806,9 @@ adbhid_input_register(int id, int default_id, int original_handler_id, | |||
807 | 806 | ||
808 | input_dev->keycode = hid->keycode; | 807 | input_dev->keycode = hid->keycode; |
809 | 808 | ||
810 | input_register_device(input_dev); | 809 | err = input_register_device(input_dev); |
810 | if (err) | ||
811 | goto fail; | ||
811 | 812 | ||
812 | if (default_id == ADB_KEYBOARD) { | 813 | if (default_id == ADB_KEYBOARD) { |
813 | /* HACK WARNING!! This should go away as soon there is an utility | 814 | /* HACK WARNING!! This should go away as soon there is an utility |
@@ -820,7 +821,10 @@ adbhid_input_register(int id, int default_id, int original_handler_id, | |||
820 | return 0; | 821 | return 0; |
821 | 822 | ||
822 | fail: input_free_device(input_dev); | 823 | fail: input_free_device(input_dev); |
823 | kfree(hid); | 824 | if (hid) { |
825 | kfree(hid->keycode); | ||
826 | kfree(hid); | ||
827 | } | ||
824 | adbhid[id] = NULL; | 828 | adbhid[id] = NULL; |
825 | return err; | 829 | return err; |
826 | } | 830 | } |
diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c index 6b129eef7987..ee6b4ca69130 100644 --- a/drivers/macintosh/mac_hid.c +++ b/drivers/macintosh/mac_hid.c | |||
@@ -106,6 +106,8 @@ EXPORT_SYMBOL(mac_hid_mouse_emulate_buttons); | |||
106 | 106 | ||
107 | static int emumousebtn_input_register(void) | 107 | static int emumousebtn_input_register(void) |
108 | { | 108 | { |
109 | int ret; | ||
110 | |||
109 | emumousebtn = input_allocate_device(); | 111 | emumousebtn = input_allocate_device(); |
110 | if (!emumousebtn) | 112 | if (!emumousebtn) |
111 | return -ENOMEM; | 113 | return -ENOMEM; |
@@ -120,9 +122,11 @@ static int emumousebtn_input_register(void) | |||
120 | emumousebtn->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); | 122 | emumousebtn->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); |
121 | emumousebtn->relbit[0] = BIT(REL_X) | BIT(REL_Y); | 123 | emumousebtn->relbit[0] = BIT(REL_X) | BIT(REL_Y); |
122 | 124 | ||
123 | input_register_device(emumousebtn); | 125 | ret = input_register_device(emumousebtn); |
126 | if (ret) | ||
127 | input_free_device(emumousebtn); | ||
124 | 128 | ||
125 | return 0; | 129 | return ret; |
126 | } | 130 | } |
127 | 131 | ||
128 | int __init mac_hid_init(void) | 132 | int __init mac_hid_init(void) |