Input: handle errors from input_register_device in drivers/macintosh
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
parent
e4477d2d1b
commit
4bdbd2807d
|
@ -689,7 +689,6 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
|
||||||
if (!hid || !input_dev) {
|
if (!hid || !input_dev) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(hid->phys, "adb%d:%d.%02x/input", id, default_id, original_handler_id);
|
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,
|
||||||
|
|
||||||
input_dev->keycode = hid->keycode;
|
input_dev->keycode = hid->keycode;
|
||||||
|
|
||||||
input_register_device(input_dev);
|
err = input_register_device(input_dev);
|
||||||
|
if (err)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
if (default_id == ADB_KEYBOARD) {
|
if (default_id == ADB_KEYBOARD) {
|
||||||
/* HACK WARNING!! This should go away as soon there is an utility
|
/* 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,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail: input_free_device(input_dev);
|
fail: input_free_device(input_dev);
|
||||||
kfree(hid);
|
if (hid) {
|
||||||
|
kfree(hid->keycode);
|
||||||
|
kfree(hid);
|
||||||
|
}
|
||||||
adbhid[id] = NULL;
|
adbhid[id] = NULL;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,8 @@ EXPORT_SYMBOL(mac_hid_mouse_emulate_buttons);
|
||||||
|
|
||||||
static int emumousebtn_input_register(void)
|
static int emumousebtn_input_register(void)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
emumousebtn = input_allocate_device();
|
emumousebtn = input_allocate_device();
|
||||||
if (!emumousebtn)
|
if (!emumousebtn)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -120,9 +122,11 @@ static int emumousebtn_input_register(void)
|
||||||
emumousebtn->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
|
emumousebtn->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
|
||||||
emumousebtn->relbit[0] = BIT(REL_X) | BIT(REL_Y);
|
emumousebtn->relbit[0] = BIT(REL_X) | BIT(REL_Y);
|
||||||
|
|
||||||
input_register_device(emumousebtn);
|
ret = input_register_device(emumousebtn);
|
||||||
|
if (ret)
|
||||||
|
input_free_device(emumousebtn);
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __init mac_hid_init(void)
|
int __init mac_hid_init(void)
|
||||||
|
|
Loading…
Reference in a new issue