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)
committerSasha Levin <alexander.levin@verizon.com>
Sat, 20 Aug 2016 03:08:41 +0000 (23:08 -0400)
commit3bdfc8b57f57425b6fc6d1bca4accfbb72d755f8
treee1ca39389b57d9e59920dcecac7c7994e3e26010
parentf3c7b15dc141f5b3c9deddf8164fae28a9b4de5f
iio: Fix error handling in iio_trigger_attach_poll_func

[ Upstream commit 99543823357966ac938d9a310947e731b67338e6 ]

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>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
drivers/iio/industrialio-trigger.c