Commit 56c3e3bb authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Ben Hutchings

staging:iio: trigger fixes for repeat request of same trigger and allocation failure

commit 5dd72ecb upstream.

Both of these are decidedly silly bugs show up whilst testing
completely different code paths.
Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 7ba4a8aa
......@@ -222,8 +222,16 @@ static int iio_trigger_attach_poll_func(struct iio_trigger *trig,
ret = request_threaded_irq(pf->irq, pf->h, pf->thread,
pf->type, pf->name,
pf);
if (trig->ops && trig->ops->set_trigger_state && notinuse)
if (ret < 0) {
module_put(pf->indio_dev->info->driver_module);
return ret;
}
if (trig->ops && trig->ops->set_trigger_state && notinuse) {
ret = trig->ops->set_trigger_state(trig, true);
if (ret < 0)
module_put(pf->indio_dev->info->driver_module);
}
return ret;
}
......@@ -336,6 +344,8 @@ static ssize_t iio_trigger_write_current(struct device *dev,
mutex_unlock(&indio_dev->mlock);
trig = iio_trigger_find_by_name(buf, len);
if (oldtrig == trig)
return len;
if (trig && indio_dev->info->validate_trigger) {
ret = indio_dev->info->validate_trigger(indio_dev, trig);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment