Skip to content

Commit

Permalink
staging: android: logger: reorder prepare_to_wait and mutex_lock
Browse files Browse the repository at this point in the history
If mutex_lock waits, it will return in state TASK_RUNNING,
rubbing out the effect of prepare_to_wait().

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Tim Bird authored and Greg Kroah-Hartman committed Feb 9, 2012
1 parent 3bcfa43 commit c76c7ca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/staging/android/logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,10 @@ static ssize_t logger_read(struct file *file, char __user *buf,

start:
while (1) {
mutex_lock(&log->mutex);

prepare_to_wait(&log->wq, &wait, TASK_INTERRUPTIBLE);

mutex_lock(&log->mutex);
ret = (log->w_off == reader->r_off);
mutex_unlock(&log->mutex);
if (!ret)
Expand Down

0 comments on commit c76c7ca

Please sign in to comment.