staging: iio: Ensure mutex is correctly unlocked in __iio_push_event

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Sunday, March 7, 2010 - 6:01 pm

Gitweb:     http://git.kernel.org/linus/75c8075394906b4bda4b056328bd9b401277d9b8
Commit:     75c8075394906b4bda4b056328bd9b401277d9b8
Parent:     0daa04a586f03de8f9022e29fb41c9dc0de28c4a
Author:     Jonathan Cameron <jic23@cam.ac.uk>
AuthorDate: Sat Jan 9 16:57:34 2010 +0000
Committer:  Greg Kroah-Hartman <gregkh@suse.de>
CommitDate: Wed Mar 3 16:42:42 2010 -0800

    staging: iio: Ensure mutex is correctly unlocked in __iio_push_event
    
    This error was picked up by running the smatch static
    checker over all the IIO subsytem.
    
    Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/staging/iio/industrialio-core.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index 768f448..87799b2 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -79,11 +79,14 @@ EXPORT_SYMBOL(__iio_change_event);
 	/* Does anyone care? */
 	mutex_lock(&ev_int->event_list_lock);
 	if (test_bit(IIO_BUSY_BIT_POS, &ev_int->handler.flags)) {
-		if (ev_int->current_events == ev_int->max_events)
+		if (ev_int->current_events == ev_int->max_events) {
+			mutex_unlock(&ev_int->event_list_lock);
 			return 0;
+		}
 		ev = kmalloc(sizeof(*ev), GFP_KERNEL);
 		if (ev == NULL) {
 			ret = -ENOMEM;
+			mutex_unlock(&ev_int->event_list_lock);
 			goto error_ret;
 		}
 		ev->ev.id = ev_code;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
staging: iio: Ensure mutex is correctly unlocked in __iio_ ..., Linux Kernel Mailing ..., (Sun Mar 7, 6:01 pm)