aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/industrialio-core.c
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@cam.ac.uk>2010-01-09 17:01:33 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-03 16:42:42 -0800
commit75b16013e29f6058e5bd648e6f4a9c03d262cf4f (patch)
tree3a3abcdc57bf0d7d2d4e5189e5ad84068eac516f /drivers/staging/iio/industrialio-core.c
parentstaging: iio: Ensure mutex is correctly unlocked in __iio_push_event (diff)
downloadlinux-dev-75b16013e29f6058e5bd648e6f4a9c03d262cf4f.tar.xz
linux-dev-75b16013e29f6058e5bd648e6f4a9c03d262cf4f.zip
staging: iio: Fix incorrect existence check for a shared event pointer.
A second smatch detected error. First part fixes in a typo in the comment directly above that I noticed whilst trying to remember what this code actually does. Second part is the actual fix. I'm fairly amazed this one never caused trouble in testing as it is in one of the most common paths. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/industrialio-core.c')
-rw-r--r--drivers/staging/iio/industrialio-core.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index 87799b2a9262..4ff683a3df31 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -292,16 +292,16 @@ ssize_t iio_event_chrdev_read(struct file *filep,
mutex_unlock(&ev_int->event_list_lock);
/*
* Possible concurency issue if an update of this event is on its way
- * through. May lead to new even being removed whilst the reported event
- * was the unescalated event. In typical use case this is not a problem
- * as userspace will say read half the buffer due to a 50% full event
- * which would make the correct 100% full incorrect anyway.
+ * through. May lead to new event being removed whilst the reported
+ * event was the unescalated event. In typical use case this is not a
+ * problem as userspace will say read half the buffer due to a 50%
+ * full event which would make the correct 100% full incorrect anyway.
*/
- spin_lock(&el->shared_pointer->lock);
- if (el->shared_pointer)
+ if (el->shared_pointer) {
+ spin_lock(&el->shared_pointer->lock);
(el->shared_pointer->ev_p) = NULL;
- spin_unlock(&el->shared_pointer->lock);
-
+ spin_unlock(&el->shared_pointer->lock);
+ }
kfree(el);
return len;