Skip to content

Commit

Permalink
Input: fix input module refcounting
Browse files Browse the repository at this point in the history
Now that input_free_device is basically an alias for input_put_device
we need to acquire a reference to input module right when we allocate
device because input_dev_release releases reference to input module
unconditionally.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Dmitry Torokhov committed Sep 14, 2006
1 parent 66e6611 commit 655816e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,8 @@ struct input_dev *input_allocate_device(void)
mutex_init(&dev->mutex);
INIT_LIST_HEAD(&dev->h_list);
INIT_LIST_HEAD(&dev->node);

__module_get(THIS_MODULE);
}

return dev;
Expand Down Expand Up @@ -985,8 +987,6 @@ int input_register_device(struct input_dev *dev)
if (error)
goto fail3;

__module_get(THIS_MODULE);

path = kobject_get_path(&dev->cdev.kobj, GFP_KERNEL);
printk(KERN_INFO "input: %s as %s\n",
dev->name ? dev->name : "Unspecified device", path ? path : "N/A");
Expand Down

0 comments on commit 655816e

Please sign in to comment.