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)
committerDanny Wood <danwood76@gmail.com>
Tue, 29 Jan 2019 13:13:43 +0000 (13:13 +0000)
commit335e25335a6dfc19bff0ca0ad4f1f9e0cf8d9955
tree4e448ac88aa1250d89cef5d9176c4022ac853574
parent2d899c7c2659591a205cb12735c33342c7897541
iio: Fix error handling in iio_trigger_attach_poll_func

commit 99543823357966ac938d9a310947e731b67338e6 upstream.

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: Willy Tarreau <w@1wt.eu>
drivers/iio/industrialio-trigger.c