diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-03-14 00:09:05 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-03-14 00:09:05 -0500 |
commit | 493a7e0d5614c30e1f3e56d59ab774300a2609f2 (patch) | |
tree | b0da1f3a92d03ca821060e4f48bf440cc12c4969 /include/linux/input.h | |
parent | 58a343f22e8ef987b90e34bbef7f1455e3bb5a15 (diff) |
Input: fix input_free_device() implementation
input_free_device can't just call kfree because if input_register_device
fails after successfully registering corresponding class device there
is a chance that someone could get a reference to it. We need to use
input_put_device() to make sure that we don't delete input device until
last reference to it was dropped.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'include/linux/input.h')
-rw-r--r-- | include/linux/input.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/linux/input.h b/include/linux/input.h index 6dca6baf06ff..cf30f3cb191a 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -421,7 +421,7 @@ struct input_absinfo { #define BTN_GEAR_UP 0x151 #define KEY_OK 0x160 -#define KEY_SELECT 0x161 +#define KEY_SELECT 0x161 #define KEY_GOTO 0x162 #define KEY_CLEAR 0x163 #define KEY_POWER2 0x164 @@ -995,11 +995,6 @@ static inline void init_input_dev(struct input_dev *dev) struct input_dev *input_allocate_device(void); -static inline void input_free_device(struct input_dev *dev) -{ - kfree(dev); -} - static inline struct input_dev *input_get_device(struct input_dev *dev) { return to_input_dev(class_device_get(&dev->cdev)); @@ -1010,6 +1005,11 @@ static inline void input_put_device(struct input_dev *dev) class_device_put(&dev->cdev); } +static inline void input_free_device(struct input_dev *dev) +{ + input_put_device(dev); +} + int input_register_device(struct input_dev *); void input_unregister_device(struct input_dev *); |