Input: fix list iteration in input_release_device()
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
diff --git a/drivers/input/input.c b/drivers/input/input.c
index e209139..9c98b6d 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -236,10 +236,12 @@
void input_release_device(struct input_handle *handle)
{
- if (handle->dev->grab == handle) {
- handle->dev->grab = NULL;
+ struct input_dev *dev = handle->dev;
- list_for_each_entry(handle, &handle->dev->h_list, d_node)
+ if (dev->grab == handle) {
+ dev->grab = NULL;
+
+ list_for_each_entry(handle, &dev->h_list, d_node)
if (handle->handler->start)
handle->handler->start(handle);
}