Commit b7d345ab authored by Rafaël Carré's avatar Rafaël Carré Committed by Ugo Riboni

davinci-audio: fix a deadlock when open()ing the device

When O_NONBLOCK is specified, try to lock the mutex and return immediately
if it failed (because another process has opened it for example)
Signed-off-by: default avatarRafaël Carré <rcarre@m2x.nl>
parent 28377221
......@@ -1037,6 +1037,11 @@ static int audio_open(struct inode *inode, struct file *file)
return -ESTALE;
}
if (file->f_flags & O_NONBLOCK) {
if(down_trylock(&state->sem))
return -EAGAIN;
}
else
down(&state->sem);
/* access control */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment