]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/iio/industrialio-event.c
iio: Return -ENODEV for file operations if the device has been unregistered
[karo-tx-linux.git] / drivers / iio / industrialio-event.c
index 36f0c8e0eb3dcfd7243ec9c60115ab270502536c..837d450457ddb678f55b8027ac5f00e91be12684 100644 (file)
@@ -76,6 +76,9 @@ static unsigned int iio_event_poll(struct file *filep,
        struct iio_event_interface *ev_int = indio_dev->event_interface;
        unsigned int events = 0;
 
+       if (!indio_dev->info)
+               return -ENODEV;
+
        poll_wait(filep, &ev_int->wait, wait);
 
        spin_lock_irq(&ev_int->wait.lock);
@@ -96,6 +99,9 @@ static ssize_t iio_event_chrdev_read(struct file *filep,
        unsigned int copied;
        int ret;
 
+       if (!indio_dev->info)
+               return -ENODEV;
+
        if (count < sizeof(struct iio_event_data))
                return -EINVAL;