staging: iio: Ensure mutex is correctly unlocked in __iio_push_event
authorJonathan Cameron <jic23@cam.ac.uk>
Sat, 9 Jan 2010 16:57:34 +0000 (16:57 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 4 Mar 2010 00:42:42 +0000 (16:42 -0800)
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

index 768f44894d087ec2fd3bc2c9b7db93f727a06ce0..87799b2a9262e5fbdc1803542b25ead96642211f 100644 (file)
@@ -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;
This page took 0.028624 seconds and 5 git commands to generate.