Skip to content

Commit

Permalink
staging: iio: Ensure mutex is correctly unlocked in __iio_push_event
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Mar 4, 2010
1 parent 0daa04a commit 75c8075
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/staging/iio/industrialio-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 75c8075

Please sign in to comment.