aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/mac_hid.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/mac_hid.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/mac_hid.c')
-rw-r--r--drivers/macintosh/mac_hid.c8
1 files changed, 6 insertions, 2 deletions
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
107static int emumousebtn_input_register(void) 107static 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
128int __init mac_hid_init(void) 132int __init mac_hid_init(void)