aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/iio/industrialio-core.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index 326e967d54ef..26564094e33b 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -242,6 +242,8 @@ static const struct file_operations iio_event_chrdev_fileops = {
242 242
243static int iio_event_getfd(struct iio_dev *indio_dev) 243static int iio_event_getfd(struct iio_dev *indio_dev)
244{ 244{
245 int fd;
246
245 if (indio_dev->event_interface == NULL) 247 if (indio_dev->event_interface == NULL)
246 return -ENODEV; 248 return -ENODEV;
247 249
@@ -252,9 +254,15 @@ static int iio_event_getfd(struct iio_dev *indio_dev)
252 return -EBUSY; 254 return -EBUSY;
253 } 255 }
254 mutex_unlock(&indio_dev->event_interface->event_list_lock); 256 mutex_unlock(&indio_dev->event_interface->event_list_lock);
255 return anon_inode_getfd("iio:event", 257 fd = anon_inode_getfd("iio:event",
256 &iio_event_chrdev_fileops, 258 &iio_event_chrdev_fileops,
257 indio_dev->event_interface, O_RDONLY); 259 indio_dev->event_interface, O_RDONLY);
260 if (fd < 0) {
261 mutex_lock(&indio_dev->event_interface->event_list_lock);
262 clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags);
263 mutex_unlock(&indio_dev->event_interface->event_list_lock);
264 }
265 return fd;
258} 266}
259 267
260static int __init iio_init(void) 268static int __init iio_init(void)