diff options
-rw-r--r-- | drivers/input/evdev.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index a9d871651ce7..76457d50bc34 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -391,14 +391,13 @@ static ssize_t evdev_read(struct file *file, char __user *buffer, | |||
391 | if (count < input_event_size()) | 391 | if (count < input_event_size()) |
392 | return -EINVAL; | 392 | return -EINVAL; |
393 | 393 | ||
394 | if (client->packet_head == client->tail && evdev->exist && | 394 | if (!(file->f_flags & O_NONBLOCK)) { |
395 | (file->f_flags & O_NONBLOCK)) | 395 | retval = wait_event_interruptible(evdev->wait, |
396 | return -EAGAIN; | 396 | client->packet_head != client->tail || |
397 | 397 | !evdev->exist); | |
398 | retval = wait_event_interruptible(evdev->wait, | 398 | if (retval) |
399 | client->packet_head != client->tail || !evdev->exist); | 399 | return retval; |
400 | if (retval) | 400 | } |
401 | return retval; | ||
402 | 401 | ||
403 | if (!evdev->exist) | 402 | if (!evdev->exist) |
404 | return -ENODEV; | 403 | return -ENODEV; |