iio: Fix error handling in iio_trigger_attach_poll_func
authorCrestez Dan Leonard <leonard.crestez@intel.com>
Tue, 3 May 2016 12:27:09 +0000 (15:27 +0300)
committerJonathan Cameron <jic23@kernel.org>
Fri, 3 Jun 2016 11:54:46 +0000 (12:54 +0100)
commit99543823357966ac938d9a310947e731b67338e6
treeb340a0e27c4a3c7ebbf2978809200c45eff77973
parent99147606155f09feccac67c65387dc62260b749b
iio: Fix error handling in iio_trigger_attach_poll_func

When attaching a pollfunc iio_trigger_attach_poll_func will allocate a
virtual irq and call the driver's set_trigger_state function. Fix error
handling to undo previous steps if any fails.

In particular this fixes handling errors from a driver's
set_trigger_state function. When using triggered buffers a failure to
enable the trigger used to make the buffer unusable.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/industrialio-trigger.c