summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/iio/addac/stx104.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/iio/addac/stx104.c b/drivers/iio/addac/stx104.c
index 8730b79e921c..0ed5f71b18cb 100644
--- a/drivers/iio/addac/stx104.c
+++ b/drivers/iio/addac/stx104.c
@@ -13,6 +13,7 @@
#include <linux/ioport.h>
#include <linux/isa.h>
#include <linux/kernel.h>
+#include <linux/limits.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/mutex.h>
@@ -181,8 +182,7 @@ static int stx104_write_raw(struct iio_dev *indio_dev,
return 0;
case IIO_CHAN_INFO_RAW:
if (chan->output) {
- /* DAC can only accept up to a 16-bit value */
- if ((unsigned int)val > 65535)
+ if (val < 0 || val > U16_MAX)
return -EINVAL;
mutex_lock(&priv->lock);