io: accel: kxcjk-1013: Fix iio_event_spec direction
authorDaniel Baluta <daniel.baluta@intel.com>
Fri, 10 Oct 2014 14:53:00 +0000 (15:53 +0100)
committerJonathan Cameron <jic23@kernel.org>
Wed, 5 Nov 2014 18:33:46 +0000 (18:33 +0000)
Because IIO_EV_DIR_* are not bitmasks but enums,
IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING is not equal
with IIO_EV_DIR_EITHER.

This could lead to potential misformatted sysfs attributes
like:
* in_accel_x_thresh_(null)_en
* in_accel_x_thresh_(null)_period
* in_accel_x_thresh_(null)_value

or even memory corruption.

Fixes: b4b491c083 (iio: accel: kxcjk-1013: Support threshold)
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/accel/kxcjk-1013.c

index 98909a9e284e408756d3b21ed848d0d32b077bfc..a23e58c4ed99b222b674ce2386c9c36a3809efbe 100644 (file)
@@ -894,7 +894,7 @@ static const struct attribute_group kxcjk1013_attrs_group = {
 
 static const struct iio_event_spec kxcjk1013_event = {
                .type = IIO_EV_TYPE_THRESH,
-               .dir = IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING,
+               .dir = IIO_EV_DIR_EITHER,
                .mask_separate = BIT(IIO_EV_INFO_VALUE) |
                                 BIT(IIO_EV_INFO_ENABLE) |
                                 BIT(IIO_EV_INFO_PERIOD)
This page took 0.025822 seconds and 5 git commands to generate.