Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: Make return value check for set_trigger_state() consistent

In `iio_trigger_detach_poll_func()` the return value from
`trig->ops->set_trigger_state(trig, false)` is checked with `if (ret)`.
However, in `iio_trigger_attach_poll_func()` it is checked with
`if (ret < 0)`. Resolve this mismatch by only checking for `if (ret)` in
both places.

Signed-off-by: Waqar Hameed <waqar.hameed@axis.com>
Link: https://lore.kernel.org/r/pndv8eojdey.fsf@axis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Waqar Hameed and committed by
Jonathan Cameron
4dc8f99d b7297d45

+1 -1
+1 -1
drivers/iio/industrialio-trigger.c
··· 313 313 /* Enable trigger in driver */ 314 314 if (trig->ops && trig->ops->set_trigger_state && notinuse) { 315 315 ret = trig->ops->set_trigger_state(trig, true); 316 - if (ret < 0) 316 + if (ret) 317 317 goto out_free_irq; 318 318 } 319 319