public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] io: accel: kxcjk-1013: Fix iio_event_spec direction
@ 2014-10-10 14:53 Daniel Baluta
  2014-10-18 11:57 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Baluta @ 2014-10-10 14:53 UTC (permalink / raw)
  To: jic23; +Cc: daniel.baluta, linux-iio, linux-kernel, srinivas.pandruvada

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>
---
 drivers/iio/accel/kxcjk-1013.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index 98909a9..a23e58c 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -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)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-04  7:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-10 14:53 [PATCH] io: accel: kxcjk-1013: Fix iio_event_spec direction Daniel Baluta
2014-10-18 11:57 ` Jonathan Cameron
2014-11-04  7:58   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox