]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: trigger: Fix condition for own trigger
authorJoão Paulo Gonçalves <joao.goncalves@toradex.com>
Fri, 14 Jun 2024 14:36:58 +0000 (11:36 -0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 17 Jun 2024 19:49:02 +0000 (20:49 +0100)
The condition for checking if triggers belong to the same IIO device to
set attached_own_device is currently inverted, causing
iio_trigger_using_own() to return an incorrect value. Fix it by testing
for the correct return value of iio_validate_own_trigger().

Cc: stable@vger.kernel.org
Fixes: 517985ebc531 ("iio: trigger: Add simple trigger_validation helper")
Signed-off-by: João Paulo Gonçalves <joao.goncalves@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/20240614143658.3531097-1-jpaulo.silvagoncalves@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/industrialio-trigger.c

index 16de57846bd9c16a48812ffd94793544122f5d12..2e84776f4fbd4d80d695c75934514372f90c2fa3 100644 (file)
@@ -315,7 +315,7 @@ int iio_trigger_attach_poll_func(struct iio_trigger *trig,
         * this is the case if the IIO device and the trigger device share the
         * same parent device.
         */
-       if (iio_validate_own_trigger(pf->indio_dev, trig))
+       if (!iio_validate_own_trigger(pf->indio_dev, trig))
                trig->attached_own_device = true;
 
        return ret;