From: Tim Bird Date: Wed, 8 Feb 2012 02:30:09 +0000 (-0800) Subject: staging: android: logger: reorder prepare_to_wait and mutex_lock X-Git-Tag: MMI-PSA29.97-13-9~17268^2~176^2~163 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c76c7ca31f16c9556cad527bfa3504b0aafb3045;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git staging: android: logger: reorder prepare_to_wait and mutex_lock If mutex_lock waits, it will return in state TASK_RUNNING, rubbing out the effect of prepare_to_wait(). Signed-off-by: Tim Bird Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c index 1e9e638cfd7a..6dd6f0490c3a 100644 --- a/drivers/staging/android/logger.c +++ b/drivers/staging/android/logger.c @@ -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)