aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/adbhid.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-11-24 00:43:22 -0500
committerDmitry Torokhov <dtor@insightbb.com>2006-11-24 00:43:22 -0500
commit4bdbd2807deeccc0793d57fb5120d7a53f2c0b3c (patch)
treeaf7f75cdffeb2d25cc4c62574b7bb3194c1faf05 /drivers/macintosh/adbhid.c
parente4477d2d1bc3e6c76e83926f7fa8c8f94ba42615 (diff)
Input: handle errors from input_register_device in drivers/macintosh
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/macintosh/adbhid.c')
-rw-r--r--drivers/macintosh/adbhid.c10
1 files changed, 7 insertions, 3 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}