diff mbox

[2/2] staging: wilc1000: wilc_msgqueue: release semaphore in error path

Message ID 1454079093-7011-2-git-send-email-chaehyun.lim@gmail.com (mailing list archive)
State Not Applicable
Delegated to: Johannes Berg
Headers show

Commit Message

Chaehyun Lim Jan. 29, 2016, 2:51 p.m. UTC
It should be called up(&mq->sem) to release semaphore before returning
error codes as -EFAULT when list is empty.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
---
 drivers/staging/wilc1000/wilc_msgqueue.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c b/drivers/staging/wilc1000/wilc_msgqueue.c
index f57e4ec..5fe85eb 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -126,6 +126,7 @@  int wilc_mq_recv(struct message_queue *mq,
 
 	if (list_empty(&mq->msg_list)) {
 		spin_unlock_irqrestore(&mq->lock, flags);
+		up(&mq->sem);
 		PRINT_ER("msg is null\n");
 		return -EFAULT;
 	}